@superdurable/connector-google-youtube 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -2
- package/dex-connector.json +221 -0
- package/dist/chunk-QT3UHJH2.js +418 -0
- package/dist/connection-C8RRmMTa.d.ts +331 -0
- package/dist/index.d.ts +346 -0
- package/dist/index.js +880 -0
- package/dist/mock.d.ts +159 -0
- package/dist/mock.js +388 -0
- package/package.json +63 -4
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { O as Operations, C as Connection, S as SearchVideosInput, d as VideoSearchPage, c as GetVideoInput, V as Video, G as GetChannelInput, b as Channel, L as ListPlaylistItemsInput, P as PlaylistItemPage, A as AddPlaylistItemInput, a as AddedPlaylistItem, o as PlaylistItem, u as VideoSearchResult } from './connection-C8RRmMTa.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for SearchVideosInput in scripted cases. */
|
|
7
|
+
declare const emptySearchVideosInput: SearchVideosInput;
|
|
8
|
+
/** Go zero value for VideoSearchResult in scripted cases. */
|
|
9
|
+
declare const emptyVideoSearchResult: VideoSearchResult;
|
|
10
|
+
/** Go zero value for VideoSearchPage in scripted cases. */
|
|
11
|
+
declare const emptyVideoSearchPage: VideoSearchPage;
|
|
12
|
+
/** Go zero value for GetVideoInput in scripted cases. */
|
|
13
|
+
declare const emptyGetVideoInput: GetVideoInput;
|
|
14
|
+
/** Go zero value for Video in scripted cases. */
|
|
15
|
+
declare const emptyVideo: Video;
|
|
16
|
+
/** Go zero value for GetChannelInput in scripted cases. */
|
|
17
|
+
declare const emptyGetChannelInput: GetChannelInput;
|
|
18
|
+
/** Go zero value for Channel in scripted cases. */
|
|
19
|
+
declare const emptyChannel: Channel;
|
|
20
|
+
/** Go zero value for ListPlaylistItemsInput in scripted cases. */
|
|
21
|
+
declare const emptyListPlaylistItemsInput: ListPlaylistItemsInput;
|
|
22
|
+
/** Go zero value for PlaylistItem in scripted cases. */
|
|
23
|
+
declare const emptyPlaylistItem: PlaylistItem;
|
|
24
|
+
/** Go zero value for PlaylistItemPage in scripted cases. */
|
|
25
|
+
declare const emptyPlaylistItemPage: PlaylistItemPage;
|
|
26
|
+
/** Go zero value for AddPlaylistItemInput in scripted cases. */
|
|
27
|
+
declare const emptyAddPlaylistItemInput: AddPlaylistItemInput;
|
|
28
|
+
/** Go zero value for AddedPlaylistItem in scripted cases. */
|
|
29
|
+
declare const emptyAddedPlaylistItem: AddedPlaylistItem;
|
|
30
|
+
/** Script the searched branch. */
|
|
31
|
+
declare function searchVideosSearched(value: VideoSearchPage, failure?: Failure): Case<VideoSearchPage>;
|
|
32
|
+
/** Script the quotaExhausted branch. */
|
|
33
|
+
declare function searchVideosQuotaExhausted(value: VideoSearchPage, failure?: Failure): Case<VideoSearchPage>;
|
|
34
|
+
/** Script the providerRejected branch. */
|
|
35
|
+
declare function searchVideosProviderRejected(value: VideoSearchPage, failure?: Failure): Case<VideoSearchPage>;
|
|
36
|
+
/** Script the invalidResponse branch. */
|
|
37
|
+
declare function searchVideosInvalidResponse(value: VideoSearchPage, failure?: Failure): Case<VideoSearchPage>;
|
|
38
|
+
/** Script the defect branch. */
|
|
39
|
+
declare function searchVideosDefect(value: VideoSearchPage, failure?: Failure): Case<VideoSearchPage>;
|
|
40
|
+
/** Script a safe retry of searchVideos. */
|
|
41
|
+
declare function searchVideosRetry(failure: Failure, retryAfterMs?: number): Case<VideoSearchPage>;
|
|
42
|
+
/** Manifest scenario matchingCompilerVideo for searchVideos. */
|
|
43
|
+
declare function searchVideosMatchingCompilerVideo(): Case<VideoSearchPage>;
|
|
44
|
+
/** Default searchVideos scenario. */
|
|
45
|
+
declare function searchVideosDefault(): Case<VideoSearchPage>;
|
|
46
|
+
/** Manifest scenario quotaExhaustedFailure for searchVideos. */
|
|
47
|
+
declare function searchVideosQuotaExhaustedFailure(): Case<VideoSearchPage>;
|
|
48
|
+
/** Manifest scenario providerRejectedFailure for searchVideos. */
|
|
49
|
+
declare function searchVideosProviderRejectedFailure(): Case<VideoSearchPage>;
|
|
50
|
+
/** Script the found branch. */
|
|
51
|
+
declare function getVideoFound(value: Video, failure?: Failure): Case<Video>;
|
|
52
|
+
/** Script the notFound branch. */
|
|
53
|
+
declare function getVideoNotFound(value: Video, failure?: Failure): Case<Video>;
|
|
54
|
+
/** Script the quotaExhausted branch. */
|
|
55
|
+
declare function getVideoQuotaExhausted(value: Video, failure?: Failure): Case<Video>;
|
|
56
|
+
/** Script the providerRejected branch. */
|
|
57
|
+
declare function getVideoProviderRejected(value: Video, failure?: Failure): Case<Video>;
|
|
58
|
+
/** Script the invalidResponse branch. */
|
|
59
|
+
declare function getVideoInvalidResponse(value: Video, failure?: Failure): Case<Video>;
|
|
60
|
+
/** Script the defect branch. */
|
|
61
|
+
declare function getVideoDefect(value: Video, failure?: Failure): Case<Video>;
|
|
62
|
+
/** Script a safe retry of getVideo. */
|
|
63
|
+
declare function getVideoRetry(failure: Failure, retryAfterMs?: number): Case<Video>;
|
|
64
|
+
/** Manifest scenario compilerVideo for getVideo. */
|
|
65
|
+
declare function getVideoCompilerVideo(): Case<Video>;
|
|
66
|
+
/** Default getVideo scenario. */
|
|
67
|
+
declare function getVideoDefault(): Case<Video>;
|
|
68
|
+
/** Manifest scenario notFoundFailure for getVideo. */
|
|
69
|
+
declare function getVideoNotFoundFailure(): Case<Video>;
|
|
70
|
+
/** Manifest scenario quotaExhaustedFailure for getVideo. */
|
|
71
|
+
declare function getVideoQuotaExhaustedFailure(): Case<Video>;
|
|
72
|
+
/** Manifest scenario providerRejectedFailure for getVideo. */
|
|
73
|
+
declare function getVideoProviderRejectedFailure(): Case<Video>;
|
|
74
|
+
/** Script the found branch. */
|
|
75
|
+
declare function getChannelFound(value: Channel, failure?: Failure): Case<Channel>;
|
|
76
|
+
/** Script the notFound branch. */
|
|
77
|
+
declare function getChannelNotFound(value: Channel, failure?: Failure): Case<Channel>;
|
|
78
|
+
/** Script the quotaExhausted branch. */
|
|
79
|
+
declare function getChannelQuotaExhausted(value: Channel, failure?: Failure): Case<Channel>;
|
|
80
|
+
/** Script the providerRejected branch. */
|
|
81
|
+
declare function getChannelProviderRejected(value: Channel, failure?: Failure): Case<Channel>;
|
|
82
|
+
/** Script the invalidResponse branch. */
|
|
83
|
+
declare function getChannelInvalidResponse(value: Channel, failure?: Failure): Case<Channel>;
|
|
84
|
+
/** Script the defect branch. */
|
|
85
|
+
declare function getChannelDefect(value: Channel, failure?: Failure): Case<Channel>;
|
|
86
|
+
/** Script a safe retry of getChannel. */
|
|
87
|
+
declare function getChannelRetry(failure: Failure, retryAfterMs?: number): Case<Channel>;
|
|
88
|
+
/** Manifest scenario compilerChannel for getChannel. */
|
|
89
|
+
declare function getChannelCompilerChannel(): Case<Channel>;
|
|
90
|
+
/** Default getChannel scenario. */
|
|
91
|
+
declare function getChannelDefault(): Case<Channel>;
|
|
92
|
+
/** Manifest scenario notFoundFailure for getChannel. */
|
|
93
|
+
declare function getChannelNotFoundFailure(): Case<Channel>;
|
|
94
|
+
/** Manifest scenario quotaExhaustedFailure for getChannel. */
|
|
95
|
+
declare function getChannelQuotaExhaustedFailure(): Case<Channel>;
|
|
96
|
+
/** Manifest scenario providerRejectedFailure for getChannel. */
|
|
97
|
+
declare function getChannelProviderRejectedFailure(): Case<Channel>;
|
|
98
|
+
/** Script the listed branch. */
|
|
99
|
+
declare function listPlaylistItemsListed(value: PlaylistItemPage, failure?: Failure): Case<PlaylistItemPage>;
|
|
100
|
+
/** Script the notFound branch. */
|
|
101
|
+
declare function listPlaylistItemsNotFound(value: PlaylistItemPage, failure?: Failure): Case<PlaylistItemPage>;
|
|
102
|
+
/** Script the quotaExhausted branch. */
|
|
103
|
+
declare function listPlaylistItemsQuotaExhausted(value: PlaylistItemPage, failure?: Failure): Case<PlaylistItemPage>;
|
|
104
|
+
/** Script the providerRejected branch. */
|
|
105
|
+
declare function listPlaylistItemsProviderRejected(value: PlaylistItemPage, failure?: Failure): Case<PlaylistItemPage>;
|
|
106
|
+
/** Script the invalidResponse branch. */
|
|
107
|
+
declare function listPlaylistItemsInvalidResponse(value: PlaylistItemPage, failure?: Failure): Case<PlaylistItemPage>;
|
|
108
|
+
/** Script the defect branch. */
|
|
109
|
+
declare function listPlaylistItemsDefect(value: PlaylistItemPage, failure?: Failure): Case<PlaylistItemPage>;
|
|
110
|
+
/** Script a safe retry of listPlaylistItems. */
|
|
111
|
+
declare function listPlaylistItemsRetry(failure: Failure, retryAfterMs?: number): Case<PlaylistItemPage>;
|
|
112
|
+
/** Manifest scenario curatedVideo for listPlaylistItems. */
|
|
113
|
+
declare function listPlaylistItemsCuratedVideo(): Case<PlaylistItemPage>;
|
|
114
|
+
/** Default listPlaylistItems scenario. */
|
|
115
|
+
declare function listPlaylistItemsDefault(): Case<PlaylistItemPage>;
|
|
116
|
+
/** Manifest scenario notFoundFailure for listPlaylistItems. */
|
|
117
|
+
declare function listPlaylistItemsNotFoundFailure(): Case<PlaylistItemPage>;
|
|
118
|
+
/** Manifest scenario quotaExhaustedFailure for listPlaylistItems. */
|
|
119
|
+
declare function listPlaylistItemsQuotaExhaustedFailure(): Case<PlaylistItemPage>;
|
|
120
|
+
/** Manifest scenario providerRejectedFailure for listPlaylistItems. */
|
|
121
|
+
declare function listPlaylistItemsProviderRejectedFailure(): Case<PlaylistItemPage>;
|
|
122
|
+
/** Script the added branch. */
|
|
123
|
+
declare function addPlaylistItemAdded(value: AddedPlaylistItem, failure?: Failure): Case<AddedPlaylistItem>;
|
|
124
|
+
/** Script the notFound branch. */
|
|
125
|
+
declare function addPlaylistItemNotFound(value: AddedPlaylistItem, failure?: Failure): Case<AddedPlaylistItem>;
|
|
126
|
+
/** Script the quotaExhausted branch. */
|
|
127
|
+
declare function addPlaylistItemQuotaExhausted(value: AddedPlaylistItem, failure?: Failure): Case<AddedPlaylistItem>;
|
|
128
|
+
/** Script the providerRejected branch. */
|
|
129
|
+
declare function addPlaylistItemProviderRejected(value: AddedPlaylistItem, failure?: Failure): Case<AddedPlaylistItem>;
|
|
130
|
+
/** Script the invalidResponse branch. */
|
|
131
|
+
declare function addPlaylistItemInvalidResponse(value: AddedPlaylistItem, failure?: Failure): Case<AddedPlaylistItem>;
|
|
132
|
+
/** Script the defect branch. */
|
|
133
|
+
declare function addPlaylistItemDefect(value: AddedPlaylistItem, failure?: Failure): Case<AddedPlaylistItem>;
|
|
134
|
+
/** Script a safe retry of addPlaylistItem. */
|
|
135
|
+
declare function addPlaylistItemRetry(failure: Failure, retryAfterMs?: number): Case<AddedPlaylistItem>;
|
|
136
|
+
/** Manifest scenario compilerVideoAdded for addPlaylistItem. */
|
|
137
|
+
declare function addPlaylistItemCompilerVideoAdded(): Case<AddedPlaylistItem>;
|
|
138
|
+
/** Default addPlaylistItem scenario. */
|
|
139
|
+
declare function addPlaylistItemDefault(): Case<AddedPlaylistItem>;
|
|
140
|
+
/** Manifest scenario notFoundFailure for addPlaylistItem. */
|
|
141
|
+
declare function addPlaylistItemNotFoundFailure(): Case<AddedPlaylistItem>;
|
|
142
|
+
/** Manifest scenario quotaExhaustedFailure for addPlaylistItem. */
|
|
143
|
+
declare function addPlaylistItemQuotaExhaustedFailure(): Case<AddedPlaylistItem>;
|
|
144
|
+
/** Manifest scenario providerRejectedFailure for addPlaylistItem. */
|
|
145
|
+
declare function addPlaylistItemProviderRejectedFailure(): Case<AddedPlaylistItem>;
|
|
146
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
147
|
+
declare class GeneratedMock implements Operations {
|
|
148
|
+
#private;
|
|
149
|
+
constructor(connectionName: string);
|
|
150
|
+
connection(): Connection;
|
|
151
|
+
searchVideos(): MockQuery<SearchVideosInput, VideoSearchPage>;
|
|
152
|
+
getVideo(): MockQuery<GetVideoInput, Video>;
|
|
153
|
+
getChannel(): MockQuery<GetChannelInput, Channel>;
|
|
154
|
+
listPlaylistItems(): MockQuery<ListPlaylistItemsInput, PlaylistItemPage>;
|
|
155
|
+
addPlaylistItem(): MockMutation<AddPlaylistItemInput, AddedPlaylistItem>;
|
|
156
|
+
assertNoFailures(): void;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { GeneratedMock, addPlaylistItemAdded, addPlaylistItemCompilerVideoAdded, addPlaylistItemDefault, addPlaylistItemDefect, addPlaylistItemInvalidResponse, addPlaylistItemNotFound, addPlaylistItemNotFoundFailure, addPlaylistItemProviderRejected, addPlaylistItemProviderRejectedFailure, addPlaylistItemQuotaExhausted, addPlaylistItemQuotaExhaustedFailure, addPlaylistItemRetry, emptyAddPlaylistItemInput, emptyAddedPlaylistItem, emptyChannel, emptyGetChannelInput, emptyGetVideoInput, emptyListPlaylistItemsInput, emptyPlaylistItem, emptyPlaylistItemPage, emptySearchVideosInput, emptyVideo, emptyVideoSearchPage, emptyVideoSearchResult, getChannelCompilerChannel, getChannelDefault, getChannelDefect, getChannelFound, getChannelInvalidResponse, getChannelNotFound, getChannelNotFoundFailure, getChannelProviderRejected, getChannelProviderRejectedFailure, getChannelQuotaExhausted, getChannelQuotaExhaustedFailure, getChannelRetry, getVideoCompilerVideo, getVideoDefault, getVideoDefect, getVideoFound, getVideoInvalidResponse, getVideoNotFound, getVideoNotFoundFailure, getVideoProviderRejected, getVideoProviderRejectedFailure, getVideoQuotaExhausted, getVideoQuotaExhaustedFailure, getVideoRetry, listPlaylistItemsCuratedVideo, listPlaylistItemsDefault, listPlaylistItemsDefect, listPlaylistItemsInvalidResponse, listPlaylistItemsListed, listPlaylistItemsNotFound, listPlaylistItemsNotFoundFailure, listPlaylistItemsProviderRejected, listPlaylistItemsProviderRejectedFailure, listPlaylistItemsQuotaExhausted, listPlaylistItemsQuotaExhaustedFailure, listPlaylistItemsRetry, searchVideosDefault, searchVideosDefect, searchVideosInvalidResponse, searchVideosMatchingCompilerVideo, searchVideosProviderRejected, searchVideosProviderRejectedFailure, searchVideosQuotaExhausted, searchVideosQuotaExhaustedFailure, searchVideosRetry, searchVideosSearched };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddPlaylistItemDefinition,
|
|
3
|
+
AddPlaylistItemInputSchema,
|
|
4
|
+
AddedPlaylistItemSchema,
|
|
5
|
+
ChannelSchema,
|
|
6
|
+
ConnectorID,
|
|
7
|
+
GetChannelDefinition,
|
|
8
|
+
GetChannelInputSchema,
|
|
9
|
+
GetVideoDefinition,
|
|
10
|
+
GetVideoInputSchema,
|
|
11
|
+
ListPlaylistItemsDefinition,
|
|
12
|
+
ListPlaylistItemsInputSchema,
|
|
13
|
+
PlaylistItemPageSchema,
|
|
14
|
+
PlaylistItemSchema,
|
|
15
|
+
ProviderID,
|
|
16
|
+
SearchVideosDefinition,
|
|
17
|
+
SearchVideosInputSchema,
|
|
18
|
+
VideoSchema,
|
|
19
|
+
VideoSearchPageSchema,
|
|
20
|
+
VideoSearchResultSchema,
|
|
21
|
+
newConnectionWithOperations
|
|
22
|
+
} from "./chunk-QT3UHJH2.js";
|
|
23
|
+
|
|
24
|
+
// src/generated/mock.ts
|
|
25
|
+
import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
26
|
+
var emptySearchVideosInput = SearchVideosInputSchema.parse({});
|
|
27
|
+
var emptyVideoSearchResult = VideoSearchResultSchema.parse({
|
|
28
|
+
"videoId": "",
|
|
29
|
+
"channelId": "",
|
|
30
|
+
"channelTitle": "",
|
|
31
|
+
"title": "",
|
|
32
|
+
"description": "",
|
|
33
|
+
"publishedAt": "0001-01-01T00:00:00Z"
|
|
34
|
+
});
|
|
35
|
+
var emptyVideoSearchPage = VideoSearchPageSchema.parse({
|
|
36
|
+
"results": [],
|
|
37
|
+
"totalResults": 0
|
|
38
|
+
});
|
|
39
|
+
var emptyGetVideoInput = GetVideoInputSchema.parse({
|
|
40
|
+
"videoId": ""
|
|
41
|
+
});
|
|
42
|
+
var emptyVideo = VideoSchema.parse({
|
|
43
|
+
"id": "",
|
|
44
|
+
"channelId": "",
|
|
45
|
+
"channelTitle": "",
|
|
46
|
+
"title": "",
|
|
47
|
+
"description": "",
|
|
48
|
+
"publishedAt": "0001-01-01T00:00:00Z",
|
|
49
|
+
"privacyStatus": ""
|
|
50
|
+
});
|
|
51
|
+
var emptyGetChannelInput = GetChannelInputSchema.parse({});
|
|
52
|
+
var emptyChannel = ChannelSchema.parse({
|
|
53
|
+
"id": "",
|
|
54
|
+
"title": "",
|
|
55
|
+
"description": "",
|
|
56
|
+
"publishedAt": "0001-01-01T00:00:00Z",
|
|
57
|
+
"uploadsPlaylistId": ""
|
|
58
|
+
});
|
|
59
|
+
var emptyListPlaylistItemsInput = ListPlaylistItemsInputSchema.parse({
|
|
60
|
+
"playlistId": ""
|
|
61
|
+
});
|
|
62
|
+
var emptyPlaylistItem = PlaylistItemSchema.parse({
|
|
63
|
+
"id": "",
|
|
64
|
+
"playlistId": "",
|
|
65
|
+
"videoId": "",
|
|
66
|
+
"title": "",
|
|
67
|
+
"position": 0,
|
|
68
|
+
"addedAt": "0001-01-01T00:00:00Z"
|
|
69
|
+
});
|
|
70
|
+
var emptyPlaylistItemPage = PlaylistItemPageSchema.parse({
|
|
71
|
+
"items": [],
|
|
72
|
+
"totalResults": 0
|
|
73
|
+
});
|
|
74
|
+
var emptyAddPlaylistItemInput = AddPlaylistItemInputSchema.parse({
|
|
75
|
+
"playlistId": "",
|
|
76
|
+
"videoId": ""
|
|
77
|
+
});
|
|
78
|
+
var emptyAddedPlaylistItem = AddedPlaylistItemSchema.parse({
|
|
79
|
+
"item": emptyPlaylistItem,
|
|
80
|
+
"wasAlreadyPresent": false
|
|
81
|
+
});
|
|
82
|
+
function searchVideosSearched(value, failure) {
|
|
83
|
+
return branchCase("searched", value, failure);
|
|
84
|
+
}
|
|
85
|
+
function searchVideosQuotaExhausted(value, failure) {
|
|
86
|
+
return branchCase("quotaExhausted", value, failure);
|
|
87
|
+
}
|
|
88
|
+
function searchVideosProviderRejected(value, failure) {
|
|
89
|
+
return branchCase("providerRejected", value, failure);
|
|
90
|
+
}
|
|
91
|
+
function searchVideosInvalidResponse(value, failure) {
|
|
92
|
+
return branchCase("invalidResponse", value, failure);
|
|
93
|
+
}
|
|
94
|
+
function searchVideosDefect(value, failure) {
|
|
95
|
+
return branchCase("defect", value, failure);
|
|
96
|
+
}
|
|
97
|
+
function searchVideosRetry(failure, retryAfterMs = 0) {
|
|
98
|
+
return retryCase(failure, retryAfterMs);
|
|
99
|
+
}
|
|
100
|
+
function searchVideosMatchingCompilerVideo() {
|
|
101
|
+
const value = emptyVideoSearchPage;
|
|
102
|
+
return branchCase("searched", value);
|
|
103
|
+
}
|
|
104
|
+
function searchVideosDefault() {
|
|
105
|
+
return searchVideosMatchingCompilerVideo();
|
|
106
|
+
}
|
|
107
|
+
function searchVideosQuotaExhaustedFailure() {
|
|
108
|
+
const value = emptyVideoSearchPage;
|
|
109
|
+
return branchCase("quotaExhausted", value, { kind: "QUOTA_EXHAUSTED", provider: ConnectorID, operation: "searchVideos", message: "The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time." });
|
|
110
|
+
}
|
|
111
|
+
function searchVideosProviderRejectedFailure() {
|
|
112
|
+
const value = emptyVideoSearchPage;
|
|
113
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "searchVideos", message: "YouTube denied the request." });
|
|
114
|
+
}
|
|
115
|
+
function getVideoFound(value, failure) {
|
|
116
|
+
return branchCase("found", value, failure);
|
|
117
|
+
}
|
|
118
|
+
function getVideoNotFound(value, failure) {
|
|
119
|
+
return branchCase("notFound", value, failure);
|
|
120
|
+
}
|
|
121
|
+
function getVideoQuotaExhausted(value, failure) {
|
|
122
|
+
return branchCase("quotaExhausted", value, failure);
|
|
123
|
+
}
|
|
124
|
+
function getVideoProviderRejected(value, failure) {
|
|
125
|
+
return branchCase("providerRejected", value, failure);
|
|
126
|
+
}
|
|
127
|
+
function getVideoInvalidResponse(value, failure) {
|
|
128
|
+
return branchCase("invalidResponse", value, failure);
|
|
129
|
+
}
|
|
130
|
+
function getVideoDefect(value, failure) {
|
|
131
|
+
return branchCase("defect", value, failure);
|
|
132
|
+
}
|
|
133
|
+
function getVideoRetry(failure, retryAfterMs = 0) {
|
|
134
|
+
return retryCase(failure, retryAfterMs);
|
|
135
|
+
}
|
|
136
|
+
function getVideoCompilerVideo() {
|
|
137
|
+
const value = VideoSchema.parse({ "channelId": "UC1234567890123456789012", "channelTitle": "Compiler Lab", "description": "A short compiler tour", "duration": "PT4M13S", "id": "AbCdEfGhI12", "privacyStatus": "public", "publishedAt": "2026-10-20T10:00:00Z", "title": "Compiler release walkthrough", "viewCount": 1200 });
|
|
138
|
+
return branchCase("found", value);
|
|
139
|
+
}
|
|
140
|
+
function getVideoDefault() {
|
|
141
|
+
return getVideoCompilerVideo();
|
|
142
|
+
}
|
|
143
|
+
function getVideoNotFoundFailure() {
|
|
144
|
+
const value = emptyVideo;
|
|
145
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getVideo", message: "No visible video has the ID, such as a deleted or private video." });
|
|
146
|
+
}
|
|
147
|
+
function getVideoQuotaExhaustedFailure() {
|
|
148
|
+
const value = emptyVideo;
|
|
149
|
+
return branchCase("quotaExhausted", value, { kind: "QUOTA_EXHAUSTED", provider: ConnectorID, operation: "getVideo", message: "The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time." });
|
|
150
|
+
}
|
|
151
|
+
function getVideoProviderRejectedFailure() {
|
|
152
|
+
const value = emptyVideo;
|
|
153
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "getVideo", message: "YouTube denied the request." });
|
|
154
|
+
}
|
|
155
|
+
function getChannelFound(value, failure) {
|
|
156
|
+
return branchCase("found", value, failure);
|
|
157
|
+
}
|
|
158
|
+
function getChannelNotFound(value, failure) {
|
|
159
|
+
return branchCase("notFound", value, failure);
|
|
160
|
+
}
|
|
161
|
+
function getChannelQuotaExhausted(value, failure) {
|
|
162
|
+
return branchCase("quotaExhausted", value, failure);
|
|
163
|
+
}
|
|
164
|
+
function getChannelProviderRejected(value, failure) {
|
|
165
|
+
return branchCase("providerRejected", value, failure);
|
|
166
|
+
}
|
|
167
|
+
function getChannelInvalidResponse(value, failure) {
|
|
168
|
+
return branchCase("invalidResponse", value, failure);
|
|
169
|
+
}
|
|
170
|
+
function getChannelDefect(value, failure) {
|
|
171
|
+
return branchCase("defect", value, failure);
|
|
172
|
+
}
|
|
173
|
+
function getChannelRetry(failure, retryAfterMs = 0) {
|
|
174
|
+
return retryCase(failure, retryAfterMs);
|
|
175
|
+
}
|
|
176
|
+
function getChannelCompilerChannel() {
|
|
177
|
+
const value = ChannelSchema.parse({ "customUrl": "@CompilerLab", "description": "Compiler tutorials", "id": "UC1234567890123456789012", "publishedAt": "2020-01-01T00:00:00Z", "title": "Compiler Lab", "uploadsPlaylistId": "UU1234567890123456789012", "videoCount": 42 });
|
|
178
|
+
return branchCase("found", value);
|
|
179
|
+
}
|
|
180
|
+
function getChannelDefault() {
|
|
181
|
+
return getChannelCompilerChannel();
|
|
182
|
+
}
|
|
183
|
+
function getChannelNotFoundFailure() {
|
|
184
|
+
const value = emptyChannel;
|
|
185
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getChannel", message: "No channel has the ID or handle, or the authorized account has no channel." });
|
|
186
|
+
}
|
|
187
|
+
function getChannelQuotaExhaustedFailure() {
|
|
188
|
+
const value = emptyChannel;
|
|
189
|
+
return branchCase("quotaExhausted", value, { kind: "QUOTA_EXHAUSTED", provider: ConnectorID, operation: "getChannel", message: "The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time." });
|
|
190
|
+
}
|
|
191
|
+
function getChannelProviderRejectedFailure() {
|
|
192
|
+
const value = emptyChannel;
|
|
193
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "getChannel", message: "YouTube denied the request." });
|
|
194
|
+
}
|
|
195
|
+
function listPlaylistItemsListed(value, failure) {
|
|
196
|
+
return branchCase("listed", value, failure);
|
|
197
|
+
}
|
|
198
|
+
function listPlaylistItemsNotFound(value, failure) {
|
|
199
|
+
return branchCase("notFound", value, failure);
|
|
200
|
+
}
|
|
201
|
+
function listPlaylistItemsQuotaExhausted(value, failure) {
|
|
202
|
+
return branchCase("quotaExhausted", value, failure);
|
|
203
|
+
}
|
|
204
|
+
function listPlaylistItemsProviderRejected(value, failure) {
|
|
205
|
+
return branchCase("providerRejected", value, failure);
|
|
206
|
+
}
|
|
207
|
+
function listPlaylistItemsInvalidResponse(value, failure) {
|
|
208
|
+
return branchCase("invalidResponse", value, failure);
|
|
209
|
+
}
|
|
210
|
+
function listPlaylistItemsDefect(value, failure) {
|
|
211
|
+
return branchCase("defect", value, failure);
|
|
212
|
+
}
|
|
213
|
+
function listPlaylistItemsRetry(failure, retryAfterMs = 0) {
|
|
214
|
+
return retryCase(failure, retryAfterMs);
|
|
215
|
+
}
|
|
216
|
+
function listPlaylistItemsCuratedVideo() {
|
|
217
|
+
const value = emptyPlaylistItemPage;
|
|
218
|
+
return branchCase("listed", value);
|
|
219
|
+
}
|
|
220
|
+
function listPlaylistItemsDefault() {
|
|
221
|
+
return listPlaylistItemsCuratedVideo();
|
|
222
|
+
}
|
|
223
|
+
function listPlaylistItemsNotFoundFailure() {
|
|
224
|
+
const value = emptyPlaylistItemPage;
|
|
225
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "listPlaylistItems", message: "No playlist visible to the account has the ID." });
|
|
226
|
+
}
|
|
227
|
+
function listPlaylistItemsQuotaExhaustedFailure() {
|
|
228
|
+
const value = emptyPlaylistItemPage;
|
|
229
|
+
return branchCase("quotaExhausted", value, { kind: "QUOTA_EXHAUSTED", provider: ConnectorID, operation: "listPlaylistItems", message: "The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time." });
|
|
230
|
+
}
|
|
231
|
+
function listPlaylistItemsProviderRejectedFailure() {
|
|
232
|
+
const value = emptyPlaylistItemPage;
|
|
233
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "listPlaylistItems", message: "YouTube denied the request." });
|
|
234
|
+
}
|
|
235
|
+
function addPlaylistItemAdded(value, failure) {
|
|
236
|
+
return branchCase("added", value, failure);
|
|
237
|
+
}
|
|
238
|
+
function addPlaylistItemNotFound(value, failure) {
|
|
239
|
+
return branchCase("notFound", value, failure);
|
|
240
|
+
}
|
|
241
|
+
function addPlaylistItemQuotaExhausted(value, failure) {
|
|
242
|
+
return branchCase("quotaExhausted", value, failure);
|
|
243
|
+
}
|
|
244
|
+
function addPlaylistItemProviderRejected(value, failure) {
|
|
245
|
+
return branchCase("providerRejected", value, failure);
|
|
246
|
+
}
|
|
247
|
+
function addPlaylistItemInvalidResponse(value, failure) {
|
|
248
|
+
return branchCase("invalidResponse", value, failure);
|
|
249
|
+
}
|
|
250
|
+
function addPlaylistItemDefect(value, failure) {
|
|
251
|
+
return branchCase("defect", value, failure);
|
|
252
|
+
}
|
|
253
|
+
function addPlaylistItemRetry(failure, retryAfterMs = 0) {
|
|
254
|
+
return retryCase(failure, retryAfterMs);
|
|
255
|
+
}
|
|
256
|
+
function addPlaylistItemCompilerVideoAdded() {
|
|
257
|
+
const value = AddedPlaylistItemSchema.parse({ "item": { "addedAt": "2026-10-26T10:00:00Z", "id": "PLITEM001", "playlistId": "PLcurated123", "position": 0, "title": "Compiler release walkthrough", "videoId": "AbCdEfGhI12", "videoPublishedAt": "2026-10-20T10:00:00Z" }, "wasAlreadyPresent": false });
|
|
258
|
+
return branchCase("added", value);
|
|
259
|
+
}
|
|
260
|
+
function addPlaylistItemDefault() {
|
|
261
|
+
return addPlaylistItemCompilerVideoAdded();
|
|
262
|
+
}
|
|
263
|
+
function addPlaylistItemNotFoundFailure() {
|
|
264
|
+
const value = emptyAddedPlaylistItem;
|
|
265
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "addPlaylistItem", message: "No playlist the account can manage or no visible video has the ID." });
|
|
266
|
+
}
|
|
267
|
+
function addPlaylistItemQuotaExhaustedFailure() {
|
|
268
|
+
const value = emptyAddedPlaylistItem;
|
|
269
|
+
return branchCase("quotaExhausted", value, { kind: "QUOTA_EXHAUSTED", provider: ConnectorID, operation: "addPlaylistItem", message: "The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time." });
|
|
270
|
+
}
|
|
271
|
+
function addPlaylistItemProviderRejectedFailure() {
|
|
272
|
+
const value = emptyAddedPlaylistItem;
|
|
273
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "addPlaylistItem", message: "YouTube denied the request." });
|
|
274
|
+
}
|
|
275
|
+
var GeneratedMock = class {
|
|
276
|
+
#searchVideos;
|
|
277
|
+
#getVideo;
|
|
278
|
+
#getChannel;
|
|
279
|
+
#listPlaylistItems;
|
|
280
|
+
#addPlaylistItem;
|
|
281
|
+
#connection;
|
|
282
|
+
constructor(connectionName) {
|
|
283
|
+
this.#searchVideos = newQuery(SearchVideosDefinition).default(searchVideosDefault());
|
|
284
|
+
this.#getVideo = newQuery(GetVideoDefinition).default(getVideoDefault());
|
|
285
|
+
this.#getChannel = newQuery(GetChannelDefinition).default(getChannelDefault());
|
|
286
|
+
this.#listPlaylistItems = newQuery(ListPlaylistItemsDefinition).default(listPlaylistItemsDefault());
|
|
287
|
+
this.#addPlaylistItem = newMutation(AddPlaylistItemDefinition).default(addPlaylistItemDefault());
|
|
288
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
289
|
+
}
|
|
290
|
+
connection() {
|
|
291
|
+
return this.#connection;
|
|
292
|
+
}
|
|
293
|
+
searchVideos() {
|
|
294
|
+
return this.#searchVideos;
|
|
295
|
+
}
|
|
296
|
+
getVideo() {
|
|
297
|
+
return this.#getVideo;
|
|
298
|
+
}
|
|
299
|
+
getChannel() {
|
|
300
|
+
return this.#getChannel;
|
|
301
|
+
}
|
|
302
|
+
listPlaylistItems() {
|
|
303
|
+
return this.#listPlaylistItems;
|
|
304
|
+
}
|
|
305
|
+
addPlaylistItem() {
|
|
306
|
+
return this.#addPlaylistItem;
|
|
307
|
+
}
|
|
308
|
+
assertNoFailures() {
|
|
309
|
+
this.#searchVideos.assertNoFailures();
|
|
310
|
+
this.#getVideo.assertNoFailures();
|
|
311
|
+
this.#getChannel.assertNoFailures();
|
|
312
|
+
this.#listPlaylistItems.assertNoFailures();
|
|
313
|
+
this.#addPlaylistItem.assertNoFailures();
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
export {
|
|
317
|
+
GeneratedMock,
|
|
318
|
+
addPlaylistItemAdded,
|
|
319
|
+
addPlaylistItemCompilerVideoAdded,
|
|
320
|
+
addPlaylistItemDefault,
|
|
321
|
+
addPlaylistItemDefect,
|
|
322
|
+
addPlaylistItemInvalidResponse,
|
|
323
|
+
addPlaylistItemNotFound,
|
|
324
|
+
addPlaylistItemNotFoundFailure,
|
|
325
|
+
addPlaylistItemProviderRejected,
|
|
326
|
+
addPlaylistItemProviderRejectedFailure,
|
|
327
|
+
addPlaylistItemQuotaExhausted,
|
|
328
|
+
addPlaylistItemQuotaExhaustedFailure,
|
|
329
|
+
addPlaylistItemRetry,
|
|
330
|
+
emptyAddPlaylistItemInput,
|
|
331
|
+
emptyAddedPlaylistItem,
|
|
332
|
+
emptyChannel,
|
|
333
|
+
emptyGetChannelInput,
|
|
334
|
+
emptyGetVideoInput,
|
|
335
|
+
emptyListPlaylistItemsInput,
|
|
336
|
+
emptyPlaylistItem,
|
|
337
|
+
emptyPlaylistItemPage,
|
|
338
|
+
emptySearchVideosInput,
|
|
339
|
+
emptyVideo,
|
|
340
|
+
emptyVideoSearchPage,
|
|
341
|
+
emptyVideoSearchResult,
|
|
342
|
+
getChannelCompilerChannel,
|
|
343
|
+
getChannelDefault,
|
|
344
|
+
getChannelDefect,
|
|
345
|
+
getChannelFound,
|
|
346
|
+
getChannelInvalidResponse,
|
|
347
|
+
getChannelNotFound,
|
|
348
|
+
getChannelNotFoundFailure,
|
|
349
|
+
getChannelProviderRejected,
|
|
350
|
+
getChannelProviderRejectedFailure,
|
|
351
|
+
getChannelQuotaExhausted,
|
|
352
|
+
getChannelQuotaExhaustedFailure,
|
|
353
|
+
getChannelRetry,
|
|
354
|
+
getVideoCompilerVideo,
|
|
355
|
+
getVideoDefault,
|
|
356
|
+
getVideoDefect,
|
|
357
|
+
getVideoFound,
|
|
358
|
+
getVideoInvalidResponse,
|
|
359
|
+
getVideoNotFound,
|
|
360
|
+
getVideoNotFoundFailure,
|
|
361
|
+
getVideoProviderRejected,
|
|
362
|
+
getVideoProviderRejectedFailure,
|
|
363
|
+
getVideoQuotaExhausted,
|
|
364
|
+
getVideoQuotaExhaustedFailure,
|
|
365
|
+
getVideoRetry,
|
|
366
|
+
listPlaylistItemsCuratedVideo,
|
|
367
|
+
listPlaylistItemsDefault,
|
|
368
|
+
listPlaylistItemsDefect,
|
|
369
|
+
listPlaylistItemsInvalidResponse,
|
|
370
|
+
listPlaylistItemsListed,
|
|
371
|
+
listPlaylistItemsNotFound,
|
|
372
|
+
listPlaylistItemsNotFoundFailure,
|
|
373
|
+
listPlaylistItemsProviderRejected,
|
|
374
|
+
listPlaylistItemsProviderRejectedFailure,
|
|
375
|
+
listPlaylistItemsQuotaExhausted,
|
|
376
|
+
listPlaylistItemsQuotaExhaustedFailure,
|
|
377
|
+
listPlaylistItemsRetry,
|
|
378
|
+
searchVideosDefault,
|
|
379
|
+
searchVideosDefect,
|
|
380
|
+
searchVideosInvalidResponse,
|
|
381
|
+
searchVideosMatchingCompilerVideo,
|
|
382
|
+
searchVideosProviderRejected,
|
|
383
|
+
searchVideosProviderRejectedFailure,
|
|
384
|
+
searchVideosQuotaExhausted,
|
|
385
|
+
searchVideosQuotaExhaustedFailure,
|
|
386
|
+
searchVideosRetry,
|
|
387
|
+
searchVideosSearched
|
|
388
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-google-youtube",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "YouTube Data API connector for Dex TypeScript Flows",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
8
|
+
"directory": "connectors/google/youtube/typescript"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
17
|
+
},
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./mock": {
|
|
26
|
+
"types": "./dist/mock.d.ts",
|
|
27
|
+
"import": "./dist/mock.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"dex-connector.json",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"lint": "eslint src test examples",
|
|
40
|
+
"test": "npm run build && vitest run --exclude 'test/integration/**'",
|
|
41
|
+
"test:integration": "npm run build && vitest run test/integration/*.integration.test.ts",
|
|
42
|
+
"check": "npm test && npm run typecheck && npm run lint",
|
|
43
|
+
"example:list": "npm run build && tsx examples/playlist-curator/main.ts",
|
|
44
|
+
"example:list:start": "npm run build && tsx examples/playlist-curator/start.ts",
|
|
45
|
+
"example:video-lookup": "npm run build && tsx examples/video-lookup/main.ts",
|
|
46
|
+
"example:video-lookup:start": "npm run build && tsx examples/video-lookup/start.ts"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@superdurable/connectors-sdk": "0.7.0",
|
|
50
|
+
"@superdurable/dex": ">=1.28.0",
|
|
51
|
+
"zod": "^4.1.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^9.0.0",
|
|
55
|
+
"@types/node": "^22.0.0",
|
|
56
|
+
"eslint": "^9.0.0",
|
|
57
|
+
"tsup": "^8.0.0",
|
|
58
|
+
"tsx": "^4.23.15",
|
|
59
|
+
"typescript": "^5.9.0",
|
|
60
|
+
"typescript-eslint": "^8.0.0",
|
|
61
|
+
"vitest": "^3.0.0",
|
|
62
|
+
"yaml": "^2.9.1"
|
|
63
|
+
},
|
|
64
|
+
"license": "MIT"
|
|
65
|
+
}
|