Skip to content

Commit

Permalink
Merge pull request #204 from NavAbility/23Q1/enh/fixes
Browse files Browse the repository at this point in the history
updates and fixes (breaking changes)
  • Loading branch information
dehann authored Feb 18, 2023
2 parents fb70d2e + a2a09f0 commit 904c5e4
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Pkg.add("NavAbilitySDK")

# Notes and FAQ

- **Which user should I use?** The Guest user is open and free for everyone to use. We recommend testing with this user, because it doesn't require any authentication. Note though, that the data is cleared on a regular basis, and that everyone can see your test data (all Guest users are created equal), so don't put anything in there that that is sensitive.
- **Which user should I use?** The Guest user is open and free for everyone to use. We recommend testing with this user, because it doesn't require any authentication. Note though, that the data is cleared on a regular basis, and that everyone can see your test data (all Guest users are created equal), so don't put anything in there that is sensitive.
- **I have sensitive data, how do I create a user?** Great question, the NavAbility services completely isolate data per user and you can create a user at any point. At the moment we create users on demand because the services are changing as we develop them, and we want to make sure we can let everyone know as they do. Send us an email at [[email protected]](mailto:[email protected]) and we'll create a user for you right away.
- Otherwise for any questions, comments, or feedback please feel free to email us at [[email protected]](mailto:[email protected]) or write an issue on the repo.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A user specific authentication token is needed whether you are just accessing an
You can login via the [NavAbility App](https://app.navability.io/get-started/introduction/) by clicking on the account menu top right. please do reach out if you have any questions via Slack [![](https://img.shields.io/badge/Invite-Slack-green.svg?style=popout)](https://join.slack.com/t/caesarjl/shared_invite/zt-ucs06bwg-y2tEbddwX1vR18MASnOLsw), emailing us at <[email protected]>, or [filing specific issues against the SDK](https://github.com/NavAbility/NavAbilitySDK.jl/issues).

```@raw html
<a href="https://app.navability.io/get-started/introduction/">
<a href="https://app.navability.io/edge/connect">
<p align="center">
<img src="https://user-images.githubusercontent.com/6412556/218193635-2325bbd1-f82c-4391-8959-8f54b2acdc0a.png" width="240" border="0" />
</p>
Expand Down
12 changes: 12 additions & 0 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
## Remove below before v0.6
## =========================

@deprecate getDataEntry(w...;kw...) getBlobEntry(w...;kw...)
@deprecate getBlobEvent(w...;kw...) getBlobEvent(w...;kw...)
@deprecate getData(w...;kw...) getBlob(w...;kw...)

@deprecate listDataEntriesEvent(w...;kw...) listBlobEntriesEvent(w...;kw...)
@deprecate listDataEntries(w...;kw...) listBlobEntries(w...;kw...)
@deprecate listDataBlobsEvent(w...;kw...) listBlobsEvent(w...;kw...)
@deprecate listDataBlobs(w...;kw...) listBlobs(w...;kw...)

@deprecate addDataEntryEvent(args...;kwargs...) addBlobEntryEvent(args...;kwargs...)
@deprecate addDataEntry(w...;kw...) addBlobEntry(w...;kw...)

@deprecate getData(client::NavAbilityClient, context::Client, fileId::AbstractString) getData(client, context, UUID(fileId))
@deprecate getDataByLabel( client::NavAbilityClient, context::Client, vlbl::AbstractString, w...; kw...) getData(client, context, vlbl, w...; kw...)

Expand Down
3 changes: 2 additions & 1 deletion src/navability/entities/Variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Base.@kwdef struct Variable
solverDataDict::String
smallData::String = "{}"
solvable::Int = 1
tags::String
""" TODO, DFG v0.19+ change to ::Vector{String} """
tags::String
timestamp::String = string(now(Dates.UTC))*"Z" # string(now(TimeZones.localzone()))
_version::String = DFG_VERSION
end
Expand Down
140 changes: 72 additions & 68 deletions src/navability/graphql/Factor.jl
Original file line number Diff line number Diff line change
@@ -1,90 +1,93 @@
GQL_FRAGMENT_FACTORS = """
fragment factor_skeleton_fields on Factor {
label
tags
_variableOrderSymbols
}
fragment factor_summary_fields on Factor {
timestamp
_version
}
fragment factor_full_fields on Factor {
fnctype
solvable
data
}
"""
fragment factor_skeleton_fields on Factor {
label
tags
_variableOrderSymbols
}
fragment factor_summary_fields on Factor {
timestamp
_version
}
fragment factor_full_fields on Factor {
fnctype
solvable
data
}
"""

GQL_GETFACTOR = """
query sdk_get_factor(
\$userId: ID!,
\$robotId: ID!,
\$sessionId: ID!,
\$label: ID!) {
users(where:{id:\$userId}) {
robots(where:{id: \$robotId}) {
sessions(where:{id: \$sessionId}) {
factors(where:{label: \$label}) {
...factor_skeleton_fields
...factor_summary_fields
...factor_full_fields
}
query sdk_get_factor(
\$userId: ID!,
\$robotId: ID!,
\$sessionId: ID!,
\$label: ID!) {
users(where:{id:\$userId}) {
robots(where:{id: \$robotId}) {
sessions(where:{id: \$sessionId}) {
factors(where:{label: \$label}) {
...factor_skeleton_fields
...factor_summary_fields
...factor_full_fields
}
}
}
}"""
}
}
"""

GQL_GETFACTORS = """
query sdk_get_factors(
\$userId: ID!,
\$robotId: ID!,
\$sessionId: ID!,
\$fields_summary: Boolean! = false,
\$fields_full: Boolean! = false){
users(where:{id:\$userId}) {
query sdk_get_factors(
\$userId: ID!,
\$robotId: ID!,
\$sessionId: ID!,
\$fields_summary: Boolean! = false,
\$fields_full: Boolean! = false){
users(where:{id:\$userId}) {
name
robots(where:{id: \$robotId}) {
name
robots(where:{id: \$robotId}) {
sessions(where:{id: \$sessionId}){
name
sessions(where:{id: \$sessionId}){
name
factors {
...factor_skeleton_fields
...factor_summary_fields @include(if: \$fields_summary)
...factor_full_fields @include(if: \$fields_full)
}
factors {
...factor_skeleton_fields
...factor_summary_fields @include(if: \$fields_summary)
...factor_full_fields @include(if: \$fields_full)
}
}
}
}"""
}
}
"""

GQL_GETFACTORSFILTERED = """
query sdk_get_factors(
\$userId: ID!,
\$robotIds: [ID!]!,
\$sessionIds: [ID!]!,
\$factor_label_regexp: String = ".*",
\$factor_tags: [String] = ["FACTOR"],
\$solvable: Int! = 0,
\$fields_summary: Boolean! = false,
\$fields_full: Boolean! = false){
users(where:{id:\$userId}) {
query sdk_get_factors(
\$userId: ID!,
\$robotIds: [ID!]!,
\$sessionIds: [ID!]!,
\$factor_label_regexp: String = ".*",
\$factor_tags: [String] = ["FACTOR"],
\$solvable: Int! = 0,
\$fields_summary: Boolean! = false,
\$fields_full: Boolean! = false){
users(where:{id:\$userId}) {
name
robots(where:{id_IN: \$robotIds}) {
name
robots(where:{id_IN: \$robotIds}) {
sessions(where:{id_IN: \$sessionIds}){
name
sessions(where:{id_IN: \$sessionIds}){
name
factors(where:{
label_MATCHES: \$factor_label_regexp,
tags: \$factor_tags,
solvable_GTE: \$solvable}) {
...factor_skeleton_fields
...factor_summary_fields @include(if: \$fields_summary)
...factor_full_fields @include(if: \$fields_full)
}
factors(where:{
label_MATCHES: \$factor_label_regexp,
tags: \$factor_tags,
solvable_GTE: \$solvable}) {
...factor_skeleton_fields
...factor_summary_fields @include(if: \$fields_summary)
...factor_full_fields @include(if: \$fields_full)
}
}
}
}"""
}
}
"""

GQL_DELETEFACTOR = """
mutation sdk_delete_factor(
Expand All @@ -100,4 +103,5 @@ GQL_DELETEFACTOR = """
progress
}
}
}"""
}
"""
28 changes: 14 additions & 14 deletions src/navability/graphql/Session.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ mutation sdk_export_session(

# get the blobId given the blob upload eventId
GQL_GET_EXPORT_SESSION_COMPLETE_EVENT_BY_ID = """
query events_by_id(\$eventId:String) {
events(where: {status:{state:Complete}, context:{eventId:\$eventId}}) {
status {
state
}
data {
... on ExportSessionComplete {
blob {
id
}
query events_by_id(\$eventId:String) {
events(where: {status:{state:Complete}, context:{eventId:\$eventId}}) {
status {
state
}
data {
... on ExportSessionComplete {
blob {
id
}
... on AddBlobMetadataComplete {
blob {
id
}
}
... on AddBlobMetadataComplete {
blob {
id
}
}
}
}
}
"""
16 changes: 8 additions & 8 deletions src/navability/graphql/Status.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ query sdk_get_statuslatest(\$id: ID!) {
"""

GQL_GET_EVENTS_BY_ID = """
query sdk_events_by_id(\$eventId:String) {
test: events(event: {context:{eventId:\$eventId}}) {
context {
eventId
}
status {
state
}
query sdk_events_by_id(\$eventId:String) {
test: events(event: {context:{eventId:\$eventId}}) {
context {
eventId
}
status {
state
}
}
}
"""
8 changes: 0 additions & 8 deletions src/navability/services/DataBlobs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ createDownload(w...) = @async createDownloadEvent(w...)

##

@deprecate getBlobEvent(w...;kw...) getBlobEvent(w...;kw...)
@deprecate getData(w...;kw...) getBlob(w...;kw...)

function getBlobEvent(
client::NavAbilityClient,
Expand Down Expand Up @@ -259,8 +257,6 @@ addData(w...) = @async addDataEvent(w...)

##

@deprecate addDataEntryEvent(args...;kwargs...) addBlobEntryEvent(args...;kwargs...)
@deprecate addDataEntry(w...;kw...) addBlobEntry(w...;kw...)

function addBlobEntryEvent(
navAbilityClient::NavAbilityClient,
Expand Down Expand Up @@ -311,7 +307,6 @@ addBlobEntry(w...) = @async addBlobEntryEvent(w...)

##

@deprecate listDataEntriesEvent(w...;kw...) listBlobEntriesEvent(w...;kw...)


function listBlobEntriesEvent(
Expand Down Expand Up @@ -373,9 +368,6 @@ Returns: Task containing a list of `BlobEntry`s
listBlobEntries(w...) = @async listBlobEntriesEvent(w...)
listBlobs(w...) = @async listBlobsEvent(w...)

@deprecate listDataBlobsEvent(w...;kw...) listBlobsEvent(w...;kw...)
@deprecate listDataBlobs(w...;kw...) listBlobs(w...;kw...)


##

Expand Down
10 changes: 8 additions & 2 deletions src/navability/services/Variable.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@

function Variable(label::AbstractString, type::Union{<:AbstractString, Symbol}, tags::AbstractVector{<:AbstractString} = ["VARIABLE"], timestamp::String = string(now(Dates.UTC))*"Z"; kwargs...)::Variable
function Variable(
label::AbstractString,
type::Union{<:AbstractString, Symbol},
tags::AbstractVector{<:AbstractString} = ["VARIABLE"],
timestamp::String = string(now(Dates.UTC))*"Z";
kwargs...
)::Variable
variableType = type isa Symbol ? get(_variableTypeConvert, type, Nothing) : type
type == Nothing && error("Variable type '$(type) is not supported")

solverDataDict = Dict("default" => _getSolverDataDict(variableType, "default"))
result = Variable(;
label,
variableType,
# TODO, should not require jsoning, see DFG#867
# TODO, should not require jsoning, see DFG#867, dropped in DFG v0.19+
solverDataDict = json(solverDataDict),
tags = json(tags),
timestamp,
Expand Down

0 comments on commit 904c5e4

Please sign in to comment.