From bbed09592607c17950a9ff423a5763975f1c3f02 Mon Sep 17 00:00:00 2001 From: Alex Zinn Date: Sat, 30 Aug 2025 20:28:53 -0400 Subject: [PATCH] fix shit --- package.json | 7 +++---- src/PCastApi.ts | 4 ++-- src/{pcast => apis}/Channels.ts | 6 +++--- src/{pcast => apis}/IResponse.ts | 0 src/{pcast => apis}/PCastRequests.ts | 0 src/{pcast => apis}/ReportKind.ts | 0 src/{pcast => apis}/Reporting.ts | 0 src/{pcast => apis}/Stream.ts | 0 src/{pcast => apis}/ViewingReportKind.ts | 0 src/{pcast => apis}/index.ts | 0 src/index.ts | 14 +++++++------- 11 files changed, 15 insertions(+), 16 deletions(-) rename src/{pcast => apis}/Channels.ts (97%) rename src/{pcast => apis}/IResponse.ts (100%) rename src/{pcast => apis}/PCastRequests.ts (100%) rename src/{pcast => apis}/ReportKind.ts (100%) rename src/{pcast => apis}/Reporting.ts (100%) rename src/{pcast => apis}/Stream.ts (100%) rename src/{pcast => apis}/ViewingReportKind.ts (100%) rename src/{pcast => apis}/index.ts (100%) diff --git a/package.json b/package.json index c49bf7d..48040df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@techniker-me/pcast-api", - "version": "2025.1.0", + "version": "2025.1.4", "type": "module", "scripts": { "ci-build": "bun run build", @@ -19,10 +19,9 @@ "build:browser:dev": "bun build src/index.ts --outdir dist/browser --target browser --format esm --development", "build:types:dev": "tsc --emitDeclarationOnly --outDir dist/types", "prebuild:dev": "bun run clean", - "build:dev": "bun run build:node:dev && bun run build:browser:dev && bun run build:types:dev", + "build:dev": "bun run build:node:dev;bun run build:browser:dev;bun run build:types:dev", "prebuild": "bun run clean", "build": "bun run build:node && bun run build:browser && bun run build:types", - "postclean": "bun run lint", "clean": "rm -rf dist", "prepublish": "bash scripts/pre-publish.sh" }, @@ -59,6 +58,6 @@ "registry": "https://registry-node.techniker.me" }, "files": [ - "dist" + "dist/" ] } diff --git a/src/PCastApi.ts b/src/PCastApi.ts index c2237ae..b8a4cd3 100644 --- a/src/PCastApi.ts +++ b/src/PCastApi.ts @@ -1,4 +1,4 @@ -import {Channels, Streams, type ApplicationCredentials, PCastHttpRequests, Reporting} from './pcast'; +import {Channels, Streams, type ApplicationCredentials, PCastHttpRequests, Reporting} from './apis'; export class PCastApi { private readonly _channels: Channels; @@ -11,7 +11,7 @@ export class PCastApi { this._reporting = reporting; } - public static create(pcastUri: string, applicationCredentials: ApplicationCredentials): Promise { + public static create(pcastUri: string, applicationCredentials: ApplicationCredentials): PCastApi { const pcastHttpRequests = new PCastHttpRequests(pcastUri.replace(/\/+$/, '').endsWith('/pcast') ? pcastUri : `${pcastUri}/pcast`, applicationCredentials); const channels = new Channels(pcastHttpRequests); const streams = new Streams(pcastHttpRequests); diff --git a/src/pcast/Channels.ts b/src/apis/Channels.ts similarity index 97% rename from src/pcast/Channels.ts rename to src/apis/Channels.ts index f3ad4aa..712dcda 100644 --- a/src/pcast/Channels.ts +++ b/src/apis/Channels.ts @@ -50,7 +50,7 @@ export class Channels { private readonly _httpRequests: PCastHttpRequests; private readonly _channelsByAlias: Map = new Map(); - private constructor(pcastHttpRequests: PCastHttpRequests) { + constructor(pcastHttpRequests: PCastHttpRequests) { this._httpRequests = pcastHttpRequests; this.initialize(); } @@ -156,7 +156,7 @@ export class Channels { throw new ChannelError(`Channel not found: ${alias}`, 'CHANNEL_NOT_FOUND'); } - return this.getChannelMembers(channel.channelId); + return this.getMembers(channel.channelId); } public async delete({channelId, alias}: {channelId?: string; alias?: string}): Promise { @@ -170,7 +170,7 @@ export class Channels { throw new ChannelError('Unable to find room to delete', 'NOT_FOUND'); } - const route = `/channel/${encodeURIComponent(channelId)}`; + const route = `/channel/${encodeURIComponent(channelIdToDelete)}`; const response = await this._httpRequests.request(HttpMethod.DELETE, route); if (!response.channel) { diff --git a/src/pcast/IResponse.ts b/src/apis/IResponse.ts similarity index 100% rename from src/pcast/IResponse.ts rename to src/apis/IResponse.ts diff --git a/src/pcast/PCastRequests.ts b/src/apis/PCastRequests.ts similarity index 100% rename from src/pcast/PCastRequests.ts rename to src/apis/PCastRequests.ts diff --git a/src/pcast/ReportKind.ts b/src/apis/ReportKind.ts similarity index 100% rename from src/pcast/ReportKind.ts rename to src/apis/ReportKind.ts diff --git a/src/pcast/Reporting.ts b/src/apis/Reporting.ts similarity index 100% rename from src/pcast/Reporting.ts rename to src/apis/Reporting.ts diff --git a/src/pcast/Stream.ts b/src/apis/Stream.ts similarity index 100% rename from src/pcast/Stream.ts rename to src/apis/Stream.ts diff --git a/src/pcast/ViewingReportKind.ts b/src/apis/ViewingReportKind.ts similarity index 100% rename from src/pcast/ViewingReportKind.ts rename to src/apis/ViewingReportKind.ts diff --git a/src/pcast/index.ts b/src/apis/index.ts similarity index 100% rename from src/pcast/index.ts rename to src/apis/index.ts diff --git a/src/index.ts b/src/index.ts index e184b53..e209c43 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1,14 @@ import {PCastApi} from './PCastApi'; -import type {Channels, Streams, Reporting, ReportKind, ViewingReportKind} from './pcast'; +import type {Channels, Streams, Reporting, ReportKind, ViewingReportKind} from './apis'; -import type {ChannelId, Channel, ChannelAlias, Member, ChannelError} from './pcast/Channels'; +import type {ChannelId, Channel, ChannelAlias, Member, ChannelError} from './apis/Channels'; import type {HttpMethod} from './net/http/HttpMethod'; import type {HttpRequestError} from './net/http/HttpRequests'; -import type {ChannelResponse, ChannelsResponse, MembersResponse} from './pcast/IResponse'; -import type {ApplicationCredentials} from './pcast/PCastRequests'; -import type {PublishingReportOptions, ViewingReportOptions} from './pcast/Reporting'; -import type {ReportKindType} from './pcast/ReportKind'; -import type {ViewingReportKindType} from './pcast/ViewingReportKind'; +import type {ChannelResponse, ChannelsResponse, MembersResponse} from './apis/IResponse'; +import type {ApplicationCredentials} from './apis/PCastRequests'; +import type {PublishingReportOptions, ViewingReportOptions} from './apis/Reporting'; +import type {ReportKindType} from './apis/ReportKind'; +import type {ViewingReportKindType} from './apis/ViewingReportKind'; export type {Channels, Streams, Reporting, ReportKind, ViewingReportKind}; export type {ChannelId, Channel, ChannelAlias, Member, ChannelError};