Skip to content

Commit

Permalink
Merge branch 'yorkie-team:main' into feat-initialRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
window9u authored Sep 7, 2024
2 parents 78bc646 + 3e49afb commit a307424
Show file tree
Hide file tree
Showing 39 changed files with 1,689 additions and 447 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ and Yorkie adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unreleased]

## [0.5.0] - 2024-09-05

### Added

- Add Concurrency Tests between Array Operations by @cloneot in https://github.com/yorkie-team/yorkie/pull/985
- Add metric for WatchDocument streams by @emplam27 in https://github.com/yorkie-team/yorkie/pull/998
- Add Account Deletion and Change Password to CLI by @sigmaith in https://github.com/yorkie-team/yorkie/pull/983

### Changed

- Optimize FindChangeInfosBetweenServerSeqs to prevent unnecessary Query by @kokodak in https://github.com/yorkie-team/yorkie/pull/974
- Rename SetByIndex to ArraySet by @hackerwins in https://github.com/yorkie-team/yorkie/pull/995

### Fixed

- Set `updated_at` with `created_at` when creating Document by @window9u in https://github.com/yorkie-team/yorkie/pull/977

## [0.4.31] - 2024-08-21

### Added
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
YORKIE_VERSION := 0.4.31
YORKIE_VERSION := 0.5.0

GO_PROJECT = github.com/yorkie-team/yorkie

Expand Down
27 changes: 27 additions & 0 deletions admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,30 @@ func withShardKey[T any](conn *connect.Request[T], keys ...string) *connect.Requ

return conn
}

// DeleteAccount deletes the user's account.
func (c *Client) DeleteAccount(ctx context.Context, username, password string) error {
_, err := c.client.DeleteAccount(ctx, connect.NewRequest(&api.DeleteAccountRequest{
Username: username,
Password: password,
}))
if err != nil {
return err
}

return nil
}

// ChangePassword changes the user's password.
func (c *Client) ChangePassword(ctx context.Context, username, password, newPassword string) error {
_, err := c.client.ChangePassword(ctx, connect.NewRequest(&api.ChangePasswordRequest{
Username: username,
CurrentPassword: password,
NewPassword: newPassword,
}))
if err != nil {
return err
}

return nil
}
27 changes: 27 additions & 0 deletions api/converter/from_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ func FromOperations(pbOps []*api.Operation) ([]operations.Operation, error) {
op, err = fromTreeEdit(decoded.TreeEdit)
case *api.Operation_TreeStyle_:
op, err = fromTreeStyle(decoded.TreeStyle)
case *api.Operation_ArraySet_:
op, err = fromArraySet(decoded.ArraySet)
default:
return nil, ErrUnsupportedOperation
}
Expand Down Expand Up @@ -539,6 +541,31 @@ func fromTreeStyle(pbTreeStyle *api.Operation_TreeStyle) (*operations.TreeStyle,
), nil
}

func fromArraySet(pbSetByIndex *api.Operation_ArraySet) (*operations.ArraySet, error) {
parentCreatedAt, err := fromTimeTicket(pbSetByIndex.ParentCreatedAt)
if err != nil {
return nil, err
}
createdAt, err := fromTimeTicket(pbSetByIndex.CreatedAt)
if err != nil {
return nil, err
}
elem, err := fromElement(pbSetByIndex.Value)
if err != nil {
return nil, err
}
executedAt, err := fromTimeTicket(pbSetByIndex.ExecutedAt)
if err != nil {
return nil, err
}
return operations.NewArraySet(
parentCreatedAt,
createdAt,
elem,
executedAt,
), nil
}

func fromCreatedAtMapByActor(
pbCreatedAtMapByActor map[string]*api.TimeTicket,
) (map[string]*time.Ticket, error) {
Expand Down
18 changes: 18 additions & 0 deletions api/converter/to_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ func ToOperations(ops []operations.Operation) ([]*api.Operation, error) {
pbOperation.Body, err = toTreeEdit(op)
case *operations.TreeStyle:
pbOperation.Body, err = toTreeStyle(op)
case *operations.ArraySet:
pbOperation.Body, err = toArraySet(op)
default:
return nil, ErrUnsupportedOperation
}
Expand Down Expand Up @@ -375,6 +377,22 @@ func toTreeStyle(style *operations.TreeStyle) (*api.Operation_TreeStyle_, error)
}, nil
}

func toArraySet(setByIndex *operations.ArraySet) (*api.Operation_ArraySet_, error) {
pbElem, err := toJSONElementSimple(setByIndex.Value())
if err != nil {
return nil, err
}

return &api.Operation_ArraySet_{
ArraySet: &api.Operation_ArraySet{
ParentCreatedAt: ToTimeTicket(setByIndex.ParentCreatedAt()),
CreatedAt: ToTimeTicket(setByIndex.CreatedAt()),
Value: pbElem,
ExecutedAt: ToTimeTicket(setByIndex.ExecutedAt()),
},
}, nil
}

func toJSONElementSimple(elem crdt.Element) (*api.JSONElementSimple, error) {
switch elem := elem.(type) {
case *crdt.Object:
Expand Down
2 changes: 1 addition & 1 deletion api/docs/yorkie.base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.1.0
info:
title: Yorkie
description: "Yorkie is an open source document store for building collaborative editing applications."
version: v0.4.31
version: v0.5.0
servers:
- url: https://api.yorkie.dev
description: Production server
Expand Down
38 changes: 37 additions & 1 deletion api/docs/yorkie/v1/admin.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: Yorkie is an open source document store for building collaborative
editing applications.
title: Yorkie
version: v0.4.31
version: v0.5.0
servers:
- description: Production server
url: https://api.yorkie.dev
Expand Down Expand Up @@ -1171,6 +1171,12 @@ components:
description: ""
title: add
type: object
arraySet:
$ref: '#/components/schemas/yorkie.v1.Operation.ArraySet'
additionalProperties: false
description: ""
title: array_set
type: object
edit:
$ref: '#/components/schemas/yorkie.v1.Operation.Edit'
additionalProperties: false
Expand Down Expand Up @@ -1257,6 +1263,36 @@ components:
type: object
title: Add
type: object
yorkie.v1.Operation.ArraySet:
additionalProperties: false
description: ""
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: ArraySet
type: object
yorkie.v1.Operation.Edit:
additionalProperties: false
description: ""
Expand Down
38 changes: 37 additions & 1 deletion api/docs/yorkie/v1/resources.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: Yorkie is an open source document store for building collaborative
editing applications.
title: Yorkie
version: v0.4.31
version: v0.5.0
servers:
- description: Production server
url: https://api.yorkie.dev
Expand Down Expand Up @@ -680,6 +680,12 @@ components:
description: ""
title: add
type: object
arraySet:
$ref: '#/components/schemas/yorkie.v1.Operation.ArraySet'
additionalProperties: false
description: ""
title: array_set
type: object
edit:
$ref: '#/components/schemas/yorkie.v1.Operation.Edit'
additionalProperties: false
Expand Down Expand Up @@ -766,6 +772,36 @@ components:
type: object
title: Add
type: object
yorkie.v1.Operation.ArraySet:
additionalProperties: false
description: ""
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: ArraySet
type: object
yorkie.v1.Operation.Edit:
additionalProperties: false
description: ""
Expand Down
38 changes: 37 additions & 1 deletion api/docs/yorkie/v1/yorkie.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: Yorkie is an open source document store for building collaborative
editing applications.
title: Yorkie
version: v0.4.31
version: v0.5.0
servers:
- description: Production server
url: https://api.yorkie.dev
Expand Down Expand Up @@ -664,6 +664,12 @@ components:
description: ""
title: add
type: object
arraySet:
$ref: '#/components/schemas/yorkie.v1.Operation.ArraySet'
additionalProperties: false
description: ""
title: array_set
type: object
edit:
$ref: '#/components/schemas/yorkie.v1.Operation.Edit'
additionalProperties: false
Expand Down Expand Up @@ -750,6 +756,36 @@ components:
type: object
title: Add
type: object
yorkie.v1.Operation.ArraySet:
additionalProperties: false
description: ""
properties:
createdAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: created_at
type: object
executedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: executed_at
type: object
parentCreatedAt:
$ref: '#/components/schemas/yorkie.v1.TimeTicket'
additionalProperties: false
description: ""
title: parent_created_at
type: object
value:
$ref: '#/components/schemas/yorkie.v1.JSONElementSimple'
additionalProperties: false
description: ""
title: value
type: object
title: ArraySet
type: object
yorkie.v1.Operation.Edit:
additionalProperties: false
description: ""
Expand Down
Loading

0 comments on commit a307424

Please sign in to comment.