Skip to content

Commit

Permalink
Minor JS changes + runner fix (#301)
Browse files Browse the repository at this point in the history
* Minor changes required for JS Chat SDK

* Change Group option on GitHub runner
  • Loading branch information
wkal-pubnub authored Oct 23, 2024
1 parent 4525c1e commit 628bb44
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commands-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Process command
if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true
runs-on:
group: Default
group: organization/Default
steps:
- name: Check referred user
id: user-check
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Check release required
if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true
runs-on:
group: Default
group: organization/Default
outputs:
release: ${{ steps.check.outputs.ready }}
steps:
Expand All @@ -31,7 +31,7 @@ jobs:
needs: check-release
if: needs.check-release.outputs.release == 'true'
runs-on:
group: Default
group: organization/Default
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
tests:
name: Integration and Unit tests
runs-on:
group: Default
group: organization/Default
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
acceptance-tests:
name: Acceptance tests
runs-on:
group: Default
group: organization/Default
env:
pubKey: somePubKey
subKey: someSubKey
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
name: Tests
needs: [tests, acceptance-tests]
runs-on:
group: Default
group: organization/Default
steps:
- name: Tests summary
run: echo -e "\033[38;2;95;215;0m\033[1mAll tests successfully passed"
6 changes: 3 additions & 3 deletions .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
pubnub-yml:
name: "Validate .pubnub.yml"
runs-on:
group: Default
group: organization/Default
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -35,7 +35,7 @@ jobs:
build-validation:
name: Validate build
runs-on:
group: Default
group: organization/Default
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -57,7 +57,7 @@ jobs:
name: Validations
needs: [pubnub-yml, build-validation]
runs-on:
group: Default
group: organization/Default
steps:
- name: Validations summary
run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed"
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,28 @@ class PubNubBaseKotlinMultiplatformPlugin : Plugin<Project> {

if (enableJsTarget) {
js { ->
useEsModules()
browser {
project.findProperty("JS_MODULE_NAME")?.toString()?.let { jsModuleName ->
moduleName = jsModuleName
}
// useEsModules()
// browser {
// testTask {
// it.useMocha {
// timeout = "10s"
// }
// }
// }
// binaries.executable()
binaries.library()
generateTypeScriptDefinitions()

nodejs {
testTask {
it.useMocha {
timeout = "10s"
timeout = "5s"
}
}
}
// nodejs {
// testTask {
// it.useMocha {
// timeout = "5s"
// }
// }
// }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ import com.pubnub.kmp.toJsMap
import kotlin.js.json
import PubNub as PubNubJs

class PubNubImpl(private val jsPubNub: PubNubJs) : PubNub {
class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
constructor(configuration: PNConfiguration) : this(PubNubJs(configuration.toJs()))

override val configuration: PNConfiguration
Expand Down Expand Up @@ -560,7 +560,7 @@ class PubNubImpl(private val jsPubNub: PubNubJs) : PubNub {
jsPubNub,
createJsObject {
this.channel = channel
this.data = ChannelMetadata(
this.data = createChannelMetadata(
PatchValue.of(name),
PatchValue.of(description),
PatchValue.of(status),
Expand Down Expand Up @@ -633,7 +633,7 @@ class PubNubImpl(private val jsPubNub: PubNubJs) : PubNub {
return SetUUIDMetadataImpl(
jsPubNub,
createJsObject {
data = UUIDMetadata(
data = createUuidMetadata(
PatchValue.of(name),
PatchValue.of(externalId),
PatchValue.of(profileUrl),
Expand Down Expand Up @@ -676,6 +676,7 @@ class PubNubImpl(private val jsPubNub: PubNubJs) : PubNub {
createJsObject {
this.sort = sort.toJsMap()
this.filter = filter
this.page = page.toMetadataPage()
this.include = createJsObject<PubNubJs.MembershipIncludeOptions> {
this.customFields = includeCustom
this.totalCount = includeCount
Expand Down Expand Up @@ -1117,7 +1118,7 @@ private fun Any.adjustCollectionTypes(): Any {
}
}

fun UUIDMetadata(
private fun createUuidMetadata(
name: PatchValue<String?>,
externalId: PatchValue<String?>,
profileUrl: PatchValue<String?>,
Expand All @@ -1137,7 +1138,7 @@ fun UUIDMetadata(
return result
}

fun ChannelMetadata(
private fun createChannelMetadata(
name: PatchValue<String?>,
description: PatchValue<String?>,
status: PatchValue<String?>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ enum class PNPushEnvironment {
fun toParamString(): String {
return name.lowercase()
}

companion object {
fun fromParamString(paramString: String): PNPushEnvironment {
return entries.first { it.toParamString() == paramString }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ enum class PNPushType(private val value: String) {
return value.lowercase()
}

companion object {
fun fromParamString(paramString: String): PNPushType {
return entries.first { it.toParamString() == paramString }
}
}

override fun toString(): String {
return value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class PNConfigurationImpl(

@Deprecated(
message = "The authKey parameter is deprecated because it relates to deprecated Access Manager (PAM V2) and will be removed in the future." +
"Please, use createPNConfiguration without authKey instead and migrate to new Access Manager " +
"(PAM V3) https://www.pubnub.com/docs/general/resources/migration-guides/pam-v3-migration ",
"Please, use createPNConfiguration without authKey instead and migrate to new Access Manager " +
"(PAM V3) https://www.pubnub.com/docs/general/resources/migration-guides/pam-v3-migration ",
level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith(
"createPNConfiguration(userId, subscribeKey, publishKey, secretKey, logVerbosity)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ internal class SubscribeMessageProcessor(
)
val queryParams = ArrayList<String>()
val authToken =
if (pubnub.tokenManager.getToken() != null){
if (pubnub.tokenManager.getToken() != null) {
pubnub.tokenManager.getToken()
} else if (pubnub.configuration.authKey.isValid()) {
pubnub.configuration.authKey
Expand Down

0 comments on commit 628bb44

Please sign in to comment.