Upgrading server package dependencies (#12559)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c19bddb51b
Коммит
2f77622b89
10
vendor/github.com/segmentio/analytics-go/History.md
сгенерированный
поставляемый
10
vendor/github.com/segmentio/analytics-go/History.md
сгенерированный
поставляемый
@@ -1,3 +1,13 @@
|
||||
|
||||
v3.1.0 / 2019-09-20
|
||||
===================
|
||||
|
||||
* add consistent panic error message
|
||||
* Expose the Message interface Validate method
|
||||
* return error if a custom type is enqueued
|
||||
* Handle pointer types in Enqueue()
|
||||
* message: update maxMessageBytes to 32KB
|
||||
|
||||
v3.0.1 / 2018-10-02
|
||||
===================
|
||||
|
||||
|
||||
2
vendor/github.com/segmentio/analytics-go/Makefile
сгенерированный
поставляемый
2
vendor/github.com/segmentio/analytics-go/Makefile
сгенерированный
поставляемый
@@ -24,7 +24,7 @@ e2e:
|
||||
@if [ "$(RUN_E2E_TESTS)" != "true" ]; then \
|
||||
echo "Skipping end to end tests."; else \
|
||||
go get github.com/segmentio/library-e2e-tester/cmd/tester; \
|
||||
tester -segment-write-key=$(SEGMENT_WRITE_KEY) -webhook-auth-username=$(WEBHOOK_AUTH_USERNAME) -webhook-bucket=$(WEBHOOK_BUCKET) -path='cli'; fi
|
||||
tester -segment-write-key=$(SEGMENT_WRITE_KEY) -webhook-auth-username=$(WEBHOOK_AUTH_USERNAME) -webhook-bucket=$(WEBHOOK_BUCKET) -path='cli' -concurrency=2 -skip='advance|alias'; fi
|
||||
|
||||
ci: dependencies test e2e
|
||||
|
||||
|
||||
8
vendor/github.com/segmentio/analytics-go/alias.go
сгенерированный
поставляемый
8
vendor/github.com/segmentio/analytics-go/alias.go
сгенерированный
поставляемый
@@ -2,6 +2,8 @@ package analytics
|
||||
|
||||
import "time"
|
||||
|
||||
var _ Message = (*Alias)(nil)
|
||||
|
||||
// This type represents object sent in a alias call as described in
|
||||
// https://segment.com/docs/libraries/http/#alias
|
||||
type Alias struct {
|
||||
@@ -17,7 +19,11 @@ type Alias struct {
|
||||
Integrations Integrations `json:"integrations,omitempty"`
|
||||
}
|
||||
|
||||
func (msg Alias) validate() error {
|
||||
func (msg Alias) internal() {
|
||||
panic(unimplementedError)
|
||||
}
|
||||
|
||||
func (msg Alias) Validate() error {
|
||||
if len(msg.UserId) == 0 {
|
||||
return FieldError{
|
||||
Type: "analytics.Alias",
|
||||
|
||||
45
vendor/github.com/segmentio/analytics-go/analytics.go
сгенерированный
поставляемый
45
vendor/github.com/segmentio/analytics-go/analytics.go
сгенерированный
поставляемый
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
// Version of the client.
|
||||
const Version = "3.0.0"
|
||||
const unimplementedError = "not implemented"
|
||||
|
||||
// This interface is the main API exposed by the analytics package.
|
||||
// Values that satsify this interface are returned by the client constructors
|
||||
@@ -104,8 +105,46 @@ func makeHttpClient(transport http.RoundTripper) http.Client {
|
||||
return httpClient
|
||||
}
|
||||
|
||||
func dereferenceMessage(msg Message) Message {
|
||||
switch m := msg.(type) {
|
||||
case *Alias:
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return *m
|
||||
case *Group:
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return *m
|
||||
case *Identify:
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return *m
|
||||
case *Page:
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return *m
|
||||
case *Screen:
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return *m
|
||||
case *Track:
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
return *m
|
||||
}
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
func (c *client) Enqueue(msg Message) (err error) {
|
||||
if err = msg.validate(); err != nil {
|
||||
msg = dereferenceMessage(msg)
|
||||
if err = msg.Validate(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -148,6 +187,10 @@ func (c *client) Enqueue(msg Message) (err error) {
|
||||
m.MessageId = makeMessageId(m.MessageId, id)
|
||||
m.Timestamp = makeTimestamp(m.Timestamp, ts)
|
||||
msg = m
|
||||
|
||||
default:
|
||||
err = fmt.Errorf("messages with custom types cannot be enqueued: %T", msg)
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
||||
8
vendor/github.com/segmentio/analytics-go/group.go
сгенерированный
поставляемый
8
vendor/github.com/segmentio/analytics-go/group.go
сгенерированный
поставляемый
@@ -2,6 +2,8 @@ package analytics
|
||||
|
||||
import "time"
|
||||
|
||||
var _ Message = (*Group)(nil)
|
||||
|
||||
// This type represents object sent in a group call as described in
|
||||
// https://segment.com/docs/libraries/http/#group
|
||||
type Group struct {
|
||||
@@ -19,7 +21,11 @@ type Group struct {
|
||||
Integrations Integrations `json:"integrations,omitempty"`
|
||||
}
|
||||
|
||||
func (msg Group) validate() error {
|
||||
func (msg Group) internal() {
|
||||
panic(unimplementedError)
|
||||
}
|
||||
|
||||
func (msg Group) Validate() error {
|
||||
if len(msg.GroupId) == 0 {
|
||||
return FieldError{
|
||||
Type: "analytics.Group",
|
||||
|
||||
8
vendor/github.com/segmentio/analytics-go/identify.go
сгенерированный
поставляемый
8
vendor/github.com/segmentio/analytics-go/identify.go
сгенерированный
поставляемый
@@ -2,6 +2,8 @@ package analytics
|
||||
|
||||
import "time"
|
||||
|
||||
var _ Message = (*Identify)(nil)
|
||||
|
||||
// This type represents object sent in an identify call as described in
|
||||
// https://segment.com/docs/libraries/http/#identify
|
||||
type Identify struct {
|
||||
@@ -18,7 +20,11 @@ type Identify struct {
|
||||
Integrations Integrations `json:"integrations,omitempty"`
|
||||
}
|
||||
|
||||
func (msg Identify) validate() error {
|
||||
func (msg Identify) internal() {
|
||||
panic(unimplementedError)
|
||||
}
|
||||
|
||||
func (msg Identify) Validate() error {
|
||||
if len(msg.UserId) == 0 && len(msg.AnonymousId) == 0 {
|
||||
return FieldError{
|
||||
Type: "analytics.Identify",
|
||||
|
||||
9
vendor/github.com/segmentio/analytics-go/message.go
сгенерированный
поставляемый
9
vendor/github.com/segmentio/analytics-go/message.go
сгенерированный
поставляемый
@@ -33,9 +33,12 @@ type Callback interface {
|
||||
// and therefore can be passed to the analytics.Client.Send method.
|
||||
type Message interface {
|
||||
|
||||
// Validates the internal structure of the message, the method must return
|
||||
// Validate validates the internal structure of the message, the method must return
|
||||
// nil if the message is valid, or an error describing what went wrong.
|
||||
validate() error
|
||||
Validate() error
|
||||
|
||||
// internal is an unexposed interface function to ensure only types defined within this package can satisfy the Message interface. Invoking this method will panic.
|
||||
internal()
|
||||
}
|
||||
|
||||
// Takes a message id as first argument and returns it, unless it's the zero-
|
||||
@@ -124,5 +127,5 @@ func (q *messageQueue) flush() (msgs []message) {
|
||||
|
||||
const (
|
||||
maxBatchBytes = 500000
|
||||
maxMessageBytes = 15000
|
||||
maxMessageBytes = 32000
|
||||
)
|
||||
|
||||
8
vendor/github.com/segmentio/analytics-go/page.go
сгенерированный
поставляемый
8
vendor/github.com/segmentio/analytics-go/page.go
сгенерированный
поставляемый
@@ -2,6 +2,8 @@ package analytics
|
||||
|
||||
import "time"
|
||||
|
||||
var _ Message = (*Page)(nil)
|
||||
|
||||
// This type represents object sent in a page call as described in
|
||||
// https://segment.com/docs/libraries/http/#page
|
||||
type Page struct {
|
||||
@@ -19,7 +21,11 @@ type Page struct {
|
||||
Integrations Integrations `json:"integrations,omitempty"`
|
||||
}
|
||||
|
||||
func (msg Page) validate() error {
|
||||
func (msg Page) internal() {
|
||||
panic(unimplementedError)
|
||||
}
|
||||
|
||||
func (msg Page) Validate() error {
|
||||
if len(msg.UserId) == 0 && len(msg.AnonymousId) == 0 {
|
||||
return FieldError{
|
||||
Type: "analytics.Page",
|
||||
|
||||
8
vendor/github.com/segmentio/analytics-go/screen.go
сгенерированный
поставляемый
8
vendor/github.com/segmentio/analytics-go/screen.go
сгенерированный
поставляемый
@@ -2,6 +2,8 @@ package analytics
|
||||
|
||||
import "time"
|
||||
|
||||
var _ Message = (*Screen)(nil)
|
||||
|
||||
// This type represents object sent in a screen call as described in
|
||||
// https://segment.com/docs/libraries/http/#screen
|
||||
type Screen struct {
|
||||
@@ -19,7 +21,11 @@ type Screen struct {
|
||||
Integrations Integrations `json:"integrations,omitempty"`
|
||||
}
|
||||
|
||||
func (msg Screen) validate() error {
|
||||
func (msg Screen) internal() {
|
||||
panic(unimplementedError)
|
||||
}
|
||||
|
||||
func (msg Screen) Validate() error {
|
||||
if len(msg.UserId) == 0 && len(msg.AnonymousId) == 0 {
|
||||
return FieldError{
|
||||
Type: "analytics.Screen",
|
||||
|
||||
8
vendor/github.com/segmentio/analytics-go/track.go
сгенерированный
поставляемый
8
vendor/github.com/segmentio/analytics-go/track.go
сгенерированный
поставляемый
@@ -2,6 +2,8 @@ package analytics
|
||||
|
||||
import "time"
|
||||
|
||||
var _ Message = (*Track)(nil)
|
||||
|
||||
// This type represents object sent in a track call as described in
|
||||
// https://segment.com/docs/libraries/http/#track
|
||||
type Track struct {
|
||||
@@ -19,7 +21,11 @@ type Track struct {
|
||||
Integrations Integrations `json:"integrations,omitempty"`
|
||||
}
|
||||
|
||||
func (msg Track) validate() error {
|
||||
func (msg Track) internal() {
|
||||
panic(unimplementedError)
|
||||
}
|
||||
|
||||
func (msg Track) Validate() error {
|
||||
if len(msg.Event) == 0 {
|
||||
return FieldError{
|
||||
Type: "analytics.Track",
|
||||
|
||||
Ссылка в новой задаче
Block a user