@twurple/ebs-helper
Advanced tools
Comparing version 6.1.0-pre.3 to 6.1.0
@@ -48,4 +48,4 @@ import { type UserIdResolvable } from '@twurple/common'; | ||
/** @private */ | ||
export declare function createPubSubMessageJwtData(broadcaster: UserIdResolvable | undefined, targets: string[]): { | ||
channel_id: string | undefined; | ||
export declare function createPubSubGlobalMessageJwtData(): { | ||
channel_id: string; | ||
pubsub_perms: { | ||
@@ -56,7 +56,20 @@ send: string[]; | ||
/** @private */ | ||
export declare function createPubSubMessageBody(targets: string[], broadcaster: UserIdResolvable | undefined, message: string): { | ||
export declare function createPubSubGlobalMessageBody(message: string): { | ||
is_global_broadcast: boolean; | ||
target: string[]; | ||
broadcaster_id: string | undefined; | ||
message: string; | ||
}; | ||
/** @private */ | ||
export declare function createPubSubMessageJwtData(broadcaster: UserIdResolvable, targets: string[]): { | ||
channel_id: string; | ||
pubsub_perms: { | ||
send: string[]; | ||
}; | ||
}; | ||
/** @private */ | ||
export declare function createPubSubMessageBody(targets: string[], broadcaster: UserIdResolvable, message: string): { | ||
target: string[]; | ||
broadcaster_id: string; | ||
message: string; | ||
}; | ||
//# sourceMappingURL=helpers.external.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createPubSubMessageBody = exports.createPubSubMessageJwtData = exports.createChatMessageBody = exports.createChatMessageJwtData = exports.createConfigurationSegmentBody = exports.createConfigurationSegmentQuery = exports.createExtensionRequiredConfigurationBody = exports.getExtensionSecretCreateQuery = exports.getExtensionSecretsQuery = exports.getExtensionQuery = void 0; | ||
exports.createPubSubMessageBody = exports.createPubSubMessageJwtData = exports.createPubSubGlobalMessageBody = exports.createPubSubGlobalMessageJwtData = exports.createChatMessageBody = exports.createChatMessageJwtData = exports.createConfigurationSegmentBody = exports.createConfigurationSegmentQuery = exports.createExtensionRequiredConfigurationBody = exports.getExtensionSecretCreateQuery = exports.getExtensionSecretsQuery = exports.getExtensionQuery = void 0; | ||
const shared_utils_1 = require("@d-fischer/shared-utils"); | ||
@@ -73,4 +73,18 @@ const common_1 = require("@twurple/common"); | ||
/** @private */ | ||
function createPubSubGlobalMessageJwtData() { | ||
return { channel_id: 'all', pubsub_perms: { send: ['global'] } }; | ||
} | ||
exports.createPubSubGlobalMessageJwtData = createPubSubGlobalMessageJwtData; | ||
/** @private */ | ||
function createPubSubGlobalMessageBody(message) { | ||
return { | ||
is_global_broadcast: true, | ||
target: ['global'], | ||
message | ||
}; | ||
} | ||
exports.createPubSubGlobalMessageBody = createPubSubGlobalMessageBody; | ||
/** @private */ | ||
function createPubSubMessageJwtData(broadcaster, targets) { | ||
return { channel_id: (0, shared_utils_1.mapOptional)(broadcaster, common_1.extractUserId), pubsub_perms: { send: targets } }; | ||
return { channel_id: (0, common_1.extractUserId)(broadcaster), pubsub_perms: { send: targets } }; | ||
} | ||
@@ -82,3 +96,3 @@ exports.createPubSubMessageJwtData = createPubSubMessageJwtData; | ||
target: targets, | ||
broadcaster_id: (0, shared_utils_1.mapOptional)(broadcaster, common_1.extractUserId), | ||
broadcaster_id: (0, common_1.extractUserId)(broadcaster), | ||
message | ||
@@ -85,0 +99,0 @@ }; |
@@ -218,3 +218,11 @@ "use strict"; | ||
async function sendExtensionPubSubGlobalMessage(config, message) { | ||
await sendAnyExtensionPubSubMessage(config, ['global'], message); | ||
const jwt = (0, jwt_1.createExternalJwt)({ | ||
...config, | ||
additionalData: (0, helpers_external_1.createPubSubGlobalMessageJwtData)() | ||
}); | ||
await (0, api_call_1.callTwitchApi)({ | ||
url: 'extensions/pubsub', | ||
method: 'POST', | ||
jsonBody: (0, helpers_external_1.createPubSubGlobalMessageBody)(message) | ||
}, config.clientId, jwt); | ||
} | ||
@@ -221,0 +229,0 @@ exports.sendExtensionPubSubGlobalMessage = sendExtensionPubSubGlobalMessage; |
{ | ||
"name": "@twurple/ebs-helper", | ||
"version": "6.1.0-pre.3", | ||
"version": "6.1.0", | ||
"publishConfig": { | ||
@@ -37,4 +37,4 @@ "access": "public" | ||
"@d-fischer/shared-utils": "^3.4.0", | ||
"@twurple/api-call": "6.1.0-pre.3", | ||
"@twurple/common": "6.1.0-pre.3", | ||
"@twurple/api-call": "6.1.0", | ||
"@twurple/common": "6.1.0", | ||
"jsonwebtoken": "^8.5.1", | ||
@@ -41,0 +41,0 @@ "tslib": "^2.0.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
50019
1169
0
+ Added@twurple/api-call@6.1.0(transitive)
+ Added@twurple/common@6.1.0(transitive)
- Removed@twurple/api-call@6.1.0-pre.3(transitive)
- Removed@twurple/common@6.1.0-pre.3(transitive)
Updated@twurple/api-call@6.1.0
Updated@twurple/common@6.1.0