@puppi/adapter-podcast-index 0.0.0-stage → 0.1.2
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 +202 -0
- package/README.md +52 -2
- package/dist/define.d.ts +18 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +12 -0
- package/dist/define.js.map +1 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +337 -0
- package/dist/index.js.map +1 -0
- package/dist/openapi.d.ts +316 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +6 -0
- package/dist/openapi.js.map +1 -0
- package/dist/operations.d.ts +15 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +34 -0
- package/dist/operations.js.map +1 -0
- package/package.json +47 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @puppi/adapter-podcast-index
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Source connector for the [Podcast Index API](https://podcastindex-org.github.io/docs-api/). `show` and `shows` resolve feeds. `episodes` lists episodes for a feed id, a feed URL, or the shows a search matched. Rows are `Show` and `Episode` in `src/index.ts`.
|
|
4
|
+
|
|
5
|
+
## Credentials
|
|
6
|
+
|
|
7
|
+
This package does not include a key. Sign up at <https://api.podcastindex.org>; the account page issues an API key and a secret.
|
|
8
|
+
|
|
9
|
+
Every request sends three headers, and `X-Auth-Date` is the unix time in seconds, refreshed on each request (the API allows about three minutes of clock skew):
|
|
10
|
+
|
|
11
|
+
| Header | Value |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `X-Auth-Key` | the API key |
|
|
14
|
+
| `X-Auth-Date` | unix time, seconds |
|
|
15
|
+
| `Authorization` | `sha1(apiKey + apiSecret + X-Auth-Date)` as lowercase hex |
|
|
16
|
+
| `User-Agent` | `puppi-adapter-podcast-index/0.1 (...)` |
|
|
17
|
+
|
|
18
|
+
The connector names one secret, `api_key`, because that is the value sent as `X-Auth-Key`. `api_secret` is never sent. The client still reads it from the binding. Add both `secret_refs`. Both resolved values are passed to the client.
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"podcast_index": {
|
|
23
|
+
"config": {},
|
|
24
|
+
"secret_refs": {
|
|
25
|
+
"api_key": "podcast_index_key",
|
|
26
|
+
"api_secret": "podcast_index_secret"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
In `bindings.local.json`, point those names at the environment:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
"secrets": {
|
|
36
|
+
"podcast_index_key": { "env": "PODCAST_INDEX_KEY" },
|
|
37
|
+
"podcast_index_secret": { "env": "PODCAST_INDEX_SECRET" }
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
A missing secret is signed as an empty string. The API answers 401, and `check()` reports that as authentication (`GET /categories/list`). Tests use the fixtures under `test/fixtures/` and do not call the live API.
|
|
42
|
+
|
|
43
|
+
`max` on an episode list defaults to 1000, which is the most one call returns. A full window of 1000 throws, because the API has no token for whatever is older. `shows({ query })` returns one search window and `cursor` is null; a full window does not throw. `episodes({ query })` uses the first `feedLimit` matches from that search, 10 when omitted, and throws above 200 ids.
|
|
44
|
+
|
|
45
|
+
## Feeds dump
|
|
46
|
+
|
|
47
|
+
`feedsDump()` downloads `https://public.podcastindex.org/podcastindex_feeds.db.tgz`, the weekly snapshot of every live feed, and returns the response body as a stream: a gzipped tar holding one SQLite file. The request is not signed, because the host is public; it sends the connector `User-Agent`, which that host requires. The connector does not unpack or read it. A 404 throws `NotFound`; any other non-2xx throws `HttpStatusError`. If the body is cut short, and the response has no `Content-Encoding` or it is `identity`, the stream asks for the rest with `Range` and `If-Range` and carries on from that byte. It gives up after three tries in a row that bring no new byte, after 20 resumes, when the host answers with the whole file instead, when the resumed range does not start at the bytes already read or end on the last byte, when the finished stream is short of a known total, or when the response is compressed.
|
|
48
|
+
|
|
49
|
+
## Rows
|
|
50
|
+
|
|
51
|
+
`Show` is a `podcasts/feeds` row. `feed_id` is the hex SHA-256 of `rss_url` in every case, the same key the RSS connector uses. The index id is only `podcast_index_id`. `known` is true. The API has no `subject_id` and no `added_at`, so those columns are not on the row.
|
|
52
|
+
|
|
53
|
+
`Episode` is a `podcasts/episodes` row, the same columns the RSS connector writes. A lookup that only has a feed id loads that show's rss URL first. `episode_id` is the item `guid` when the item has one, otherwise the hex SHA-256 of `feed_id` + `audio_url` with nothing between them, and `guid` is that same hash. `audio_url` is the enclosure. `published_at` is the append watermark; the next poll passes that time, in unix seconds, as `since`. `observed_at` is when this client read the row. An item with no enclosure URL or no `datePublished` is skipped.
|
package/dist/define.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
readonly type: "podcast-index";
|
|
3
|
+
readonly docs: "https://podcastindex-org.github.io/docs-api/";
|
|
4
|
+
readonly configSchema: {
|
|
5
|
+
readonly base_url: "string";
|
|
6
|
+
};
|
|
7
|
+
readonly secretFields: readonly ["api_key"];
|
|
8
|
+
readonly auth: {
|
|
9
|
+
readonly scheme: "api_key_header";
|
|
10
|
+
readonly header: "X-Auth-Key";
|
|
11
|
+
readonly secret: "api_key";
|
|
12
|
+
};
|
|
13
|
+
readonly apiVersions: readonly ["unversioned"];
|
|
14
|
+
readonly defaultApiVersion: "unversioned";
|
|
15
|
+
readonly defaultBaseUrl: "https://api.podcastindex.org/api/1.0";
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,wBASG"}
|
package/dist/define.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConnector } from "@puppi/sdk";
|
|
2
|
+
export default defineConnector({
|
|
3
|
+
type: "podcast-index",
|
|
4
|
+
docs: "https://podcastindex-org.github.io/docs-api/",
|
|
5
|
+
configSchema: { base_url: "string" },
|
|
6
|
+
secretFields: ["api_key"],
|
|
7
|
+
auth: { scheme: "api_key_header", header: "X-Auth-Key", secret: "api_key" },
|
|
8
|
+
apiVersions: ["unversioned"],
|
|
9
|
+
defaultApiVersion: "unversioned",
|
|
10
|
+
defaultBaseUrl: "https://api.podcastindex.org/api/1.0",
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAe,eAAe,CAAC;IAC7B,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,8CAA8C;IACpD,YAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;IACpC,YAAY,EAAE,CAAC,SAAS,CAAC;IACzB,IAAI,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE;IAC3E,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,iBAAiB,EAAE,aAAa;IAChC,cAAc,EAAE,sCAAsC;CACvD,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@puppi/adapter-podcast-index`: a source connector over the Podcast Index
|
|
3
|
+
* API. Each request is signed with `X-Auth-Key`, `X-Auth-Date`, and
|
|
4
|
+
* `Authorization: sha1(apiKey + apiSecret + unixTime)`. The date is refreshed
|
|
5
|
+
* per request; the API rejects a timestamp outside a three-minute window.
|
|
6
|
+
* `api_secret` is a second binding secret. The connector can name only
|
|
7
|
+
* `api_key`.
|
|
8
|
+
*/
|
|
9
|
+
import { type CredentialCheck, type ClientOptions, type HttpResult, OpenApiClient, type Page, type RequestOptions } from "@puppi/sdk";
|
|
10
|
+
import connector from "./define.js";
|
|
11
|
+
import { type Api } from "./operations.js";
|
|
12
|
+
export default connector;
|
|
13
|
+
/** The weekly SQLite dump of every live feed. Public, unsigned. */
|
|
14
|
+
export declare const FEEDS_DUMP_URL = "https://public.podcastindex.org/podcastindex_feeds.db.tgz";
|
|
15
|
+
/**
|
|
16
|
+
* A `podcasts/feeds` row. `feed_id` is the hex SHA-256 of `rss_url`, the same
|
|
17
|
+
* key the RSS connector uses. The index id stays in `podcast_index_id`.
|
|
18
|
+
* `subject_id` and `added_at` are not here: the API has no Puppi subject,
|
|
19
|
+
* and no time the feed was added.
|
|
20
|
+
*/
|
|
21
|
+
export interface Show {
|
|
22
|
+
feed_id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
rss_url: string;
|
|
25
|
+
podcast_index_id: number | null;
|
|
26
|
+
image_url: string | null;
|
|
27
|
+
author: string | null;
|
|
28
|
+
language: string | null;
|
|
29
|
+
known: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A `podcasts/episodes` row, shared with the RSS connector.
|
|
33
|
+
* `episode_id` is the item guid, or the SHA-256 of `feed_id` + `audio_url`
|
|
34
|
+
* when that guid is missing. `guid` is that same hash in the missing case.
|
|
35
|
+
* `published_at` is the append watermark.
|
|
36
|
+
* `observed_at` is when this client read the row.
|
|
37
|
+
*/
|
|
38
|
+
export interface Episode {
|
|
39
|
+
episode_id: string;
|
|
40
|
+
feed_id: string;
|
|
41
|
+
guid: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description: string | null;
|
|
44
|
+
/** ISO 8601. The append watermark. */
|
|
45
|
+
published_at: string;
|
|
46
|
+
audio_url: string;
|
|
47
|
+
audio_type: string | null;
|
|
48
|
+
audio_bytes: number | null;
|
|
49
|
+
duration_sec: number | null;
|
|
50
|
+
episode_url: string | null;
|
|
51
|
+
season: number | null;
|
|
52
|
+
episode_n: number | null;
|
|
53
|
+
/** ISO 8601. */
|
|
54
|
+
observed_at: string;
|
|
55
|
+
}
|
|
56
|
+
interface PageOptions {
|
|
57
|
+
/** Episodes per page. Defaults to the API cap of 1000. */
|
|
58
|
+
max?: number;
|
|
59
|
+
/** Only episodes published after this unix time. */
|
|
60
|
+
since?: number;
|
|
61
|
+
/** Episodes already returned. Null starts at the newest. */
|
|
62
|
+
cursor?: number | null;
|
|
63
|
+
}
|
|
64
|
+
export type EpisodeQuery = ({
|
|
65
|
+
feedId: number;
|
|
66
|
+
} & PageOptions) | ({
|
|
67
|
+
feedUrl: string;
|
|
68
|
+
} & PageOptions) | ({
|
|
69
|
+
query: string;
|
|
70
|
+
feedLimit?: number;
|
|
71
|
+
} & PageOptions);
|
|
72
|
+
export declare class Client extends OpenApiClient<Api> {
|
|
73
|
+
private readonly apiKey;
|
|
74
|
+
private readonly apiSecret;
|
|
75
|
+
private readonly now;
|
|
76
|
+
constructor(config: Record<string, unknown>, secrets?: Record<string, string>, options?: ClientOptions & {
|
|
77
|
+
now?: () => Date;
|
|
78
|
+
});
|
|
79
|
+
/** `GET /categories/list` proves `api_key`. */
|
|
80
|
+
check(): Promise<CredentialCheck>;
|
|
81
|
+
/** The feed for an id or URL, or null when the index does not know it. */
|
|
82
|
+
show(args: {
|
|
83
|
+
feedId: number;
|
|
84
|
+
} | {
|
|
85
|
+
feedUrl: string;
|
|
86
|
+
}): Promise<Show | null>;
|
|
87
|
+
/** Shows matching `query`. The API returns one window, so `cursor` is always null. */
|
|
88
|
+
shows(args: {
|
|
89
|
+
query: string;
|
|
90
|
+
max?: number;
|
|
91
|
+
cursor?: number | null;
|
|
92
|
+
}): AsyncGenerator<Page<Show, null>>;
|
|
93
|
+
/**
|
|
94
|
+
* Episodes for a feed id, a feed URL, or the shows a search matched.
|
|
95
|
+
* A feed id is resolved to its rss URL first, so `feed_id` is the hash of
|
|
96
|
+
* that URL. Newest first. `published_at` is the append watermark: the next poll
|
|
97
|
+
* passes that time, in unix seconds, as `since`. `cursor` is only how
|
|
98
|
+
* many episodes this poll already returned. There is no page token: the
|
|
99
|
+
* API returns the newest `max` (at most 1000), so the next page asks for
|
|
100
|
+
* a wider window and yields the new tail. A publish between those requests
|
|
101
|
+
* shifts that newest-first window, so an `episode_id` already yielded in
|
|
102
|
+
* this poll is skipped. A full window at 1000 throws, because anything
|
|
103
|
+
* older was not returned.
|
|
104
|
+
*/
|
|
105
|
+
episodes(args: EpisodeQuery): AsyncGenerator<Page<Episode, number>>;
|
|
106
|
+
/**
|
|
107
|
+
* The weekly feeds dump as it downloads: a gzipped tar holding one SQLite
|
|
108
|
+
* file. Unsigned, because the dump host is public. The caller reads the stream.
|
|
109
|
+
*/
|
|
110
|
+
feedsDump(): Promise<ReadableStream<Uint8Array>>;
|
|
111
|
+
protected dispatch<T>(pathOrUrl: string, init?: {
|
|
112
|
+
method?: RequestOptions["method"];
|
|
113
|
+
body?: unknown;
|
|
114
|
+
}): Promise<HttpResult<T>>;
|
|
115
|
+
/** A feed URL, or index ids whose rss URLs are already known. Null when nothing can be keyed. */
|
|
116
|
+
private episodeTarget;
|
|
117
|
+
/** The rss URL for an index id, or null when the index does not know the feed. */
|
|
118
|
+
private rssUrl;
|
|
119
|
+
private matchingFeeds;
|
|
120
|
+
private episodeBody;
|
|
121
|
+
private sign;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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AAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAkBpC;;;;;;;;;;;OAWG;IAEI,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IA2D1E;;;OAGG;IAEH,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;cAI7B,QAAQ,CAAC,CAAC,EAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAO,GAC/D,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAMzB,iGAAiG;YACnF,aAAa;IAiB3B,kFAAkF;YACpE,MAAM;YAcN,aAAa;IAgC3B,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,IAAI;CAeb"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@puppi/adapter-podcast-index`: a source connector over the Podcast Index
|
|
3
|
+
* API. Each request is signed with `X-Auth-Key`, `X-Auth-Date`, and
|
|
4
|
+
* `Authorization: sha1(apiKey + apiSecret + unixTime)`. The date is refreshed
|
|
5
|
+
* per request; the API rejects a timestamp outside a three-minute window.
|
|
6
|
+
* `api_secret` is a second binding secret. The connector can name only
|
|
7
|
+
* `api_key`.
|
|
8
|
+
*/
|
|
9
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
10
|
+
var useValue = arguments.length > 2;
|
|
11
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
12
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
13
|
+
}
|
|
14
|
+
return useValue ? value : void 0;
|
|
15
|
+
};
|
|
16
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
17
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
18
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
19
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
20
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
21
|
+
var _, done = false;
|
|
22
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
23
|
+
var context = {};
|
|
24
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
25
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
26
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
27
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
28
|
+
if (kind === "accessor") {
|
|
29
|
+
if (result === void 0) continue;
|
|
30
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
31
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
32
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
33
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
34
|
+
}
|
|
35
|
+
else if (_ = accept(result)) {
|
|
36
|
+
if (kind === "field") initializers.unshift(_);
|
|
37
|
+
else descriptor[key] = _;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
41
|
+
done = true;
|
|
42
|
+
};
|
|
43
|
+
import { createHash } from "node:crypto";
|
|
44
|
+
import { read, NotFound, OpenApiClient, openApiClientOptions, } from "@puppi/sdk";
|
|
45
|
+
import connector from "./define.js";
|
|
46
|
+
import { operations } from "./operations.js";
|
|
47
|
+
export default connector;
|
|
48
|
+
const type = connector.type;
|
|
49
|
+
const auth = connector.auth;
|
|
50
|
+
/** One call returns at most this many episodes, and `max` cannot be higher. */
|
|
51
|
+
const EPISODE_CAP = 1000;
|
|
52
|
+
/** `episodes/byfeedid` accepts at most this many comma-separated ids. */
|
|
53
|
+
const ID_LIST_CAP = 200;
|
|
54
|
+
/** How many shows a search contributes when the caller does not say. */
|
|
55
|
+
const DEFAULT_SHOW_MATCHES = 10;
|
|
56
|
+
/** The weekly SQLite dump of every live feed. Public, unsigned. */
|
|
57
|
+
export const FEEDS_DUMP_URL = "https://public.podcastindex.org/podcastindex_feeds.db.tgz";
|
|
58
|
+
let Client = (() => {
|
|
59
|
+
let _classSuper = OpenApiClient;
|
|
60
|
+
let _instanceExtraInitializers = [];
|
|
61
|
+
let _show_decorators;
|
|
62
|
+
let _shows_decorators;
|
|
63
|
+
let _episodes_decorators;
|
|
64
|
+
let _feedsDump_decorators;
|
|
65
|
+
return class Client extends _classSuper {
|
|
66
|
+
static {
|
|
67
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
68
|
+
_show_decorators = [read];
|
|
69
|
+
_shows_decorators = [read];
|
|
70
|
+
_episodes_decorators = [read];
|
|
71
|
+
_feedsDump_decorators = [read];
|
|
72
|
+
__esDecorate(this, null, _show_decorators, { kind: "method", name: "show", static: false, private: false, access: { has: obj => "show" in obj, get: obj => obj.show }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
|
+
__esDecorate(this, null, _shows_decorators, { kind: "method", name: "shows", static: false, private: false, access: { has: obj => "shows" in obj, get: obj => obj.shows }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
|
+
__esDecorate(this, null, _episodes_decorators, { kind: "method", name: "episodes", static: false, private: false, access: { has: obj => "episodes" in obj, get: obj => obj.episodes }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
75
|
+
__esDecorate(this, null, _feedsDump_decorators, { kind: "method", name: "feedsDump", static: false, private: false, access: { has: obj => "feedsDump" in obj, get: obj => obj.feedsDump }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
77
|
+
}
|
|
78
|
+
apiKey = __runInitializers(this, _instanceExtraInitializers);
|
|
79
|
+
apiSecret;
|
|
80
|
+
now;
|
|
81
|
+
constructor(config, secrets = {}, options = {}) {
|
|
82
|
+
super(config, options, ...openApiClientOptions(connector, config, secrets, operations));
|
|
83
|
+
this.apiKey = secrets[auth.secret] ?? "";
|
|
84
|
+
this.apiSecret = secrets["api_secret"] ?? "";
|
|
85
|
+
this.now = options.now ?? (() => new Date());
|
|
86
|
+
}
|
|
87
|
+
/** `GET /categories/list` proves `api_key`. */
|
|
88
|
+
check() {
|
|
89
|
+
return this.prove("/categories/list", auth.secret);
|
|
90
|
+
}
|
|
91
|
+
/** The feed for an id or URL, or null when the index does not know it. */
|
|
92
|
+
async show(args) {
|
|
93
|
+
try {
|
|
94
|
+
const body = "feedId" in args
|
|
95
|
+
? await this.read("podcastByFeedId", { query: { id: args.feedId } })
|
|
96
|
+
: await this.read("podcastByFeedUrl", { query: { url: args.feedUrl } });
|
|
97
|
+
if (!accepted(body.status) || !body.feed)
|
|
98
|
+
return null;
|
|
99
|
+
return toShow(body.feed);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error instanceof NotFound)
|
|
103
|
+
return null;
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** Shows matching `query`. The API returns one window, so `cursor` is always null. */
|
|
108
|
+
async *shows(args) {
|
|
109
|
+
if (typeof args.cursor === "number")
|
|
110
|
+
return;
|
|
111
|
+
const body = await this.read("searchPodcasts", {
|
|
112
|
+
query: { q: args.query, max: args.max, fulltext: true },
|
|
113
|
+
});
|
|
114
|
+
if (!accepted(body.status))
|
|
115
|
+
return;
|
|
116
|
+
const data = (body.feeds ?? []).flatMap((item) => {
|
|
117
|
+
const row = toShow(item);
|
|
118
|
+
return row === null ? [] : [row];
|
|
119
|
+
});
|
|
120
|
+
if (data.length > 0)
|
|
121
|
+
yield { cursor: null, data };
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Episodes for a feed id, a feed URL, or the shows a search matched.
|
|
125
|
+
* A feed id is resolved to its rss URL first, so `feed_id` is the hash of
|
|
126
|
+
* that URL. Newest first. `published_at` is the append watermark: the next poll
|
|
127
|
+
* passes that time, in unix seconds, as `since`. `cursor` is only how
|
|
128
|
+
* many episodes this poll already returned. There is no page token: the
|
|
129
|
+
* API returns the newest `max` (at most 1000), so the next page asks for
|
|
130
|
+
* a wider window and yields the new tail. A publish between those requests
|
|
131
|
+
* shifts that newest-first window, so an `episode_id` already yielded in
|
|
132
|
+
* this poll is skipped. A full window at 1000 throws, because anything
|
|
133
|
+
* older was not returned.
|
|
134
|
+
*/
|
|
135
|
+
async *episodes(args) {
|
|
136
|
+
const pageSize = args.max ?? EPISODE_CAP;
|
|
137
|
+
if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > EPISODE_CAP) {
|
|
138
|
+
throw new Error(`${type} max must be an integer from 1 to ${EPISODE_CAP}`);
|
|
139
|
+
}
|
|
140
|
+
let offset = args.cursor ?? 0;
|
|
141
|
+
if (!Number.isInteger(offset) || offset < 0) {
|
|
142
|
+
throw new Error(`${type} cursor must be a non-negative integer`);
|
|
143
|
+
}
|
|
144
|
+
const target = await this.episodeTarget(args);
|
|
145
|
+
if (target === null)
|
|
146
|
+
return;
|
|
147
|
+
const seen = new Set();
|
|
148
|
+
for (;;) {
|
|
149
|
+
const requested = offset + pageSize;
|
|
150
|
+
if (requested > EPISODE_CAP) {
|
|
151
|
+
throw new Error(capMessage());
|
|
152
|
+
}
|
|
153
|
+
const body = await this.episodeBody(target, args.since, requested);
|
|
154
|
+
if (!accepted(body.status))
|
|
155
|
+
return;
|
|
156
|
+
const raw = body.items ?? [];
|
|
157
|
+
const observedAt = this.now().toISOString();
|
|
158
|
+
if (raw.length < offset) {
|
|
159
|
+
throw new Error(`${type} returned ${raw.length} episodes after ${offset} were already read`);
|
|
160
|
+
}
|
|
161
|
+
if (raw.length >= EPISODE_CAP)
|
|
162
|
+
throw new Error(capMessage());
|
|
163
|
+
const page = raw.slice(offset).flatMap((item) => {
|
|
164
|
+
const row = toEpisode(item, observedAt, rssFor(item, target));
|
|
165
|
+
if (row === null || seen.has(row.episode_id))
|
|
166
|
+
return [];
|
|
167
|
+
seen.add(row.episode_id);
|
|
168
|
+
return [row];
|
|
169
|
+
});
|
|
170
|
+
const more = raw.length === requested;
|
|
171
|
+
if (page.length > 0)
|
|
172
|
+
yield { data: page, cursor: more ? requested : null };
|
|
173
|
+
if (!more)
|
|
174
|
+
return;
|
|
175
|
+
offset = requested;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The weekly feeds dump as it downloads: a gzipped tar holding one SQLite
|
|
180
|
+
* file. Unsigned, because the dump host is public. The caller reads the stream.
|
|
181
|
+
*/
|
|
182
|
+
feedsDump() {
|
|
183
|
+
return this.download(FEEDS_DUMP_URL);
|
|
184
|
+
}
|
|
185
|
+
dispatch(pathOrUrl, init = {}) {
|
|
186
|
+
this.sign();
|
|
187
|
+
return super.dispatch(pathOrUrl, init);
|
|
188
|
+
}
|
|
189
|
+
/** A feed URL, or index ids whose rss URLs are already known. Null when nothing can be keyed. */
|
|
190
|
+
async episodeTarget(args) {
|
|
191
|
+
if ("feedUrl" in args)
|
|
192
|
+
return { url: args.feedUrl, rssUrl: args.feedUrl, rssById: new Map() };
|
|
193
|
+
if (!("query" in args)) {
|
|
194
|
+
const rssUrl = await this.rssUrl(args.feedId);
|
|
195
|
+
return rssUrl === null
|
|
196
|
+
? null
|
|
197
|
+
: { id: String(args.feedId), rssUrl, rssById: new Map([[args.feedId, rssUrl]]) };
|
|
198
|
+
}
|
|
199
|
+
const feeds = await this.matchingFeeds(args.query, args.feedLimit);
|
|
200
|
+
return feeds.length === 0
|
|
201
|
+
? null
|
|
202
|
+
: { id: feeds.map(([id]) => String(id)).join(","), rssById: new Map(feeds) };
|
|
203
|
+
}
|
|
204
|
+
/** The rss URL for an index id, or null when the index does not know the feed. */
|
|
205
|
+
async rssUrl(feedId) {
|
|
206
|
+
try {
|
|
207
|
+
const body = await this.read("podcastByFeedId", { query: { id: feedId } });
|
|
208
|
+
if (!accepted(body.status) || !body.feed)
|
|
209
|
+
return null;
|
|
210
|
+
return text(body.feed.url);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
if (error instanceof NotFound)
|
|
214
|
+
return null;
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async matchingFeeds(query, feedLimit) {
|
|
219
|
+
const body = await this.read("searchPodcasts", {
|
|
220
|
+
query: { q: query, max: feedLimit ?? DEFAULT_SHOW_MATCHES },
|
|
221
|
+
});
|
|
222
|
+
if (!accepted(body.status))
|
|
223
|
+
return [];
|
|
224
|
+
const feeds = [];
|
|
225
|
+
const seen = new Set();
|
|
226
|
+
for (const item of body.feeds ?? []) {
|
|
227
|
+
const id = whole(item.id);
|
|
228
|
+
const url = text(item.url);
|
|
229
|
+
if (id === null || url === null || seen.has(id))
|
|
230
|
+
continue;
|
|
231
|
+
seen.add(id);
|
|
232
|
+
feeds.push([id, url]);
|
|
233
|
+
}
|
|
234
|
+
if (feeds.length > ID_LIST_CAP) {
|
|
235
|
+
throw new Error(`${type} search matched ${feeds.length} shows; episodes/byfeedid accepts at most ${ID_LIST_CAP} ids`);
|
|
236
|
+
}
|
|
237
|
+
return feeds;
|
|
238
|
+
}
|
|
239
|
+
episodeBody(target, since, max) {
|
|
240
|
+
if (target.url !== undefined) {
|
|
241
|
+
return this.read("episodesByFeedUrl", {
|
|
242
|
+
query: { url: target.url, since, max, fulltext: true },
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
return this.read("episodesByFeedId", {
|
|
246
|
+
query: { id: target.id, since, max, fulltext: true },
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
sign() {
|
|
250
|
+
delete this.headers["X-Auth-Date"];
|
|
251
|
+
delete this.headers["X-Auth-Key"];
|
|
252
|
+
delete this.headers["Authorization"];
|
|
253
|
+
if (this.apiKey === "")
|
|
254
|
+
return;
|
|
255
|
+
const unix = Math.floor(this.now().getTime() / 1000);
|
|
256
|
+
this.headers["X-Auth-Date"] = String(unix);
|
|
257
|
+
this.headers["X-Auth-Key"] = this.apiKey;
|
|
258
|
+
this.headers["Authorization"] = createHash("sha1")
|
|
259
|
+
.update(`${this.apiKey}${this.apiSecret}${unix}`)
|
|
260
|
+
.digest("hex");
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
})();
|
|
264
|
+
export { Client };
|
|
265
|
+
function capMessage() {
|
|
266
|
+
return `${type} returned ${EPISODE_CAP} episodes, the most one call returns, so the list is incomplete`;
|
|
267
|
+
}
|
|
268
|
+
function rssFor(item, target) {
|
|
269
|
+
if (typeof item.feedId === "number") {
|
|
270
|
+
const known = target.rssById.get(item.feedId);
|
|
271
|
+
if (known !== undefined)
|
|
272
|
+
return known;
|
|
273
|
+
}
|
|
274
|
+
return target.rssUrl ?? null;
|
|
275
|
+
}
|
|
276
|
+
function toShow(feed) {
|
|
277
|
+
const rssUrl = text(feed.url) ?? "";
|
|
278
|
+
const feedId = feedKey(rssUrl);
|
|
279
|
+
if (feedId === null)
|
|
280
|
+
return null;
|
|
281
|
+
return {
|
|
282
|
+
feed_id: feedId,
|
|
283
|
+
title: text(feed.title) ?? "",
|
|
284
|
+
rss_url: rssUrl,
|
|
285
|
+
podcast_index_id: whole(feed.id),
|
|
286
|
+
image_url: text(feed.artwork) ?? text(feed.image),
|
|
287
|
+
author: text(feed.author),
|
|
288
|
+
language: text(feed.language),
|
|
289
|
+
known: true,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function toEpisode(item, observedAt, rssUrl) {
|
|
293
|
+
const audioUrl = text(item.enclosureUrl);
|
|
294
|
+
const publishedAt = unixIso(item.datePublished);
|
|
295
|
+
const feedId = rssUrl === null ? null : feedKey(rssUrl);
|
|
296
|
+
if (audioUrl === null || publishedAt === null || feedId === null)
|
|
297
|
+
return null;
|
|
298
|
+
const rssGuid = text(item.guid);
|
|
299
|
+
const episodeId = rssGuid ?? sha256(feedId + audioUrl);
|
|
300
|
+
return {
|
|
301
|
+
episode_id: episodeId,
|
|
302
|
+
feed_id: feedId,
|
|
303
|
+
guid: rssGuid ?? episodeId,
|
|
304
|
+
title: text(item.title) ?? "",
|
|
305
|
+
description: text(item.description),
|
|
306
|
+
published_at: publishedAt,
|
|
307
|
+
audio_url: audioUrl,
|
|
308
|
+
audio_type: text(item.enclosureType),
|
|
309
|
+
audio_bytes: whole(item.enclosureLength),
|
|
310
|
+
duration_sec: whole(item.duration),
|
|
311
|
+
episode_url: text(item.link),
|
|
312
|
+
season: whole(item.season),
|
|
313
|
+
episode_n: whole(item.episode),
|
|
314
|
+
observed_at: observedAt,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/** Hex SHA-256 of the rss URL. The same input the RSS connector hashes. */
|
|
318
|
+
function feedKey(rssUrl) {
|
|
319
|
+
return rssUrl === "" ? null : sha256(rssUrl);
|
|
320
|
+
}
|
|
321
|
+
function sha256(value) {
|
|
322
|
+
return createHash("sha256").update(value).digest("hex");
|
|
323
|
+
}
|
|
324
|
+
function accepted(status) {
|
|
325
|
+
return status !== false && status !== "false";
|
|
326
|
+
}
|
|
327
|
+
function text(value) {
|
|
328
|
+
return value || null;
|
|
329
|
+
}
|
|
330
|
+
function whole(value) {
|
|
331
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
332
|
+
}
|
|
333
|
+
function unixIso(value) {
|
|
334
|
+
const time = whole(value);
|
|
335
|
+
return time === null ? null : new Date(time * 1000).toISOString();
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,IAAI,EAIJ,QAAQ,EACR,aAAa,EACb,oBAAoB,GAGrB,MAAM,YAAY,CAAC;AAEpB,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAY,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEvD,eAAe,SAAS,CAAC;AAEzB,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAC5B,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAE5B,+EAA+E;AAC/E,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,yEAAyE;AACzE,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,wEAAwE;AACxE,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,mEAAmE;AACnE,MAAM,CAAC,MAAM,cAAc,GAAG,2DAA2D,CAAC;IA6D7E,MAAM;sBAAS,aAAa;;;;;;iBAA5B,MAAO,SAAQ,WAAkB;;;gCAsB3C,IAAI;iCAmBJ,IAAI;oCAmCJ,IAAI;qCAgEJ,IAAI;YArHL,+JAAM,IAAI,6DAeT;YAID,kKAAO,KAAK,6DAoBX;YAeD,2KAAO,QAAQ,6DAyDd;YAOD,8KAAA,SAAS,6DAER;;;QA9IgB,MAAM,GADZ,mDAAM,CACe;QACf,SAAS,CAAS;QAClB,GAAG,CAAa;QAEjC,YACE,MAA+B,EAC/B,UAAkC,EAAE,EACpC,UAAgD,EAAE;YAElD,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,oBAAoB,CA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SAAS,KAAK,CAAC,KAAyB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
export type paths = {
|
|
6
|
+
"/categories/list": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
/** Category list, the cheap authenticated check. */
|
|
14
|
+
get: operations["listCategories"];
|
|
15
|
+
put?: never;
|
|
16
|
+
post?: never;
|
|
17
|
+
delete?: never;
|
|
18
|
+
options?: never;
|
|
19
|
+
head?: never;
|
|
20
|
+
patch?: never;
|
|
21
|
+
trace?: never;
|
|
22
|
+
};
|
|
23
|
+
"/podcasts/byfeedid": {
|
|
24
|
+
parameters: {
|
|
25
|
+
query?: never;
|
|
26
|
+
header?: never;
|
|
27
|
+
path?: never;
|
|
28
|
+
cookie?: never;
|
|
29
|
+
};
|
|
30
|
+
get: operations["podcastByFeedId"];
|
|
31
|
+
put?: never;
|
|
32
|
+
post?: never;
|
|
33
|
+
delete?: never;
|
|
34
|
+
options?: never;
|
|
35
|
+
head?: never;
|
|
36
|
+
patch?: never;
|
|
37
|
+
trace?: never;
|
|
38
|
+
};
|
|
39
|
+
"/podcasts/byfeedurl": {
|
|
40
|
+
parameters: {
|
|
41
|
+
query?: never;
|
|
42
|
+
header?: never;
|
|
43
|
+
path?: never;
|
|
44
|
+
cookie?: never;
|
|
45
|
+
};
|
|
46
|
+
get: operations["podcastByFeedUrl"];
|
|
47
|
+
put?: never;
|
|
48
|
+
post?: never;
|
|
49
|
+
delete?: never;
|
|
50
|
+
options?: never;
|
|
51
|
+
head?: never;
|
|
52
|
+
patch?: never;
|
|
53
|
+
trace?: never;
|
|
54
|
+
};
|
|
55
|
+
"/search/byterm": {
|
|
56
|
+
parameters: {
|
|
57
|
+
query?: never;
|
|
58
|
+
header?: never;
|
|
59
|
+
path?: never;
|
|
60
|
+
cookie?: never;
|
|
61
|
+
};
|
|
62
|
+
get: operations["searchPodcasts"];
|
|
63
|
+
put?: never;
|
|
64
|
+
post?: never;
|
|
65
|
+
delete?: never;
|
|
66
|
+
options?: never;
|
|
67
|
+
head?: never;
|
|
68
|
+
patch?: never;
|
|
69
|
+
trace?: never;
|
|
70
|
+
};
|
|
71
|
+
"/episodes/byfeedid": {
|
|
72
|
+
parameters: {
|
|
73
|
+
query?: never;
|
|
74
|
+
header?: never;
|
|
75
|
+
path?: never;
|
|
76
|
+
cookie?: never;
|
|
77
|
+
};
|
|
78
|
+
get: operations["episodesByFeedId"];
|
|
79
|
+
put?: never;
|
|
80
|
+
post?: never;
|
|
81
|
+
delete?: never;
|
|
82
|
+
options?: never;
|
|
83
|
+
head?: never;
|
|
84
|
+
patch?: never;
|
|
85
|
+
trace?: never;
|
|
86
|
+
};
|
|
87
|
+
"/episodes/byfeedurl": {
|
|
88
|
+
parameters: {
|
|
89
|
+
query?: never;
|
|
90
|
+
header?: never;
|
|
91
|
+
path?: never;
|
|
92
|
+
cookie?: never;
|
|
93
|
+
};
|
|
94
|
+
get: operations["episodesByFeedUrl"];
|
|
95
|
+
put?: never;
|
|
96
|
+
post?: never;
|
|
97
|
+
delete?: never;
|
|
98
|
+
options?: never;
|
|
99
|
+
head?: never;
|
|
100
|
+
patch?: never;
|
|
101
|
+
trace?: never;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export type webhooks = Record<string, never>;
|
|
105
|
+
export type components = {
|
|
106
|
+
schemas: {
|
|
107
|
+
feed: {
|
|
108
|
+
id?: number;
|
|
109
|
+
podcastGuid?: string;
|
|
110
|
+
title?: string;
|
|
111
|
+
url?: string;
|
|
112
|
+
link?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
author?: string;
|
|
115
|
+
image?: string;
|
|
116
|
+
artwork?: string;
|
|
117
|
+
lastUpdateTime?: number;
|
|
118
|
+
newestItemPublishTime?: number;
|
|
119
|
+
newestItemPubdate?: number;
|
|
120
|
+
language?: string;
|
|
121
|
+
explicit?: boolean;
|
|
122
|
+
episodeCount?: number;
|
|
123
|
+
itunesId?: number;
|
|
124
|
+
categories?: {
|
|
125
|
+
[key: string]: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
episode: {
|
|
129
|
+
id?: number;
|
|
130
|
+
title?: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
guid?: string;
|
|
133
|
+
datePublished?: number;
|
|
134
|
+
duration?: number;
|
|
135
|
+
link?: string;
|
|
136
|
+
enclosureUrl?: string;
|
|
137
|
+
enclosureType?: string;
|
|
138
|
+
enclosureLength?: number;
|
|
139
|
+
explicit?: number;
|
|
140
|
+
episode?: number;
|
|
141
|
+
season?: number;
|
|
142
|
+
episodeType?: string;
|
|
143
|
+
image?: string;
|
|
144
|
+
feedId?: number;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
responses: never;
|
|
148
|
+
parameters: never;
|
|
149
|
+
requestBodies: never;
|
|
150
|
+
headers: never;
|
|
151
|
+
pathItems: never;
|
|
152
|
+
};
|
|
153
|
+
export type SchemaFeed = components["schemas"]["feed"];
|
|
154
|
+
export type SchemaEpisode = components["schemas"]["episode"];
|
|
155
|
+
export type $defs = Record<string, never>;
|
|
156
|
+
export interface operations {
|
|
157
|
+
listCategories: {
|
|
158
|
+
parameters: {
|
|
159
|
+
query?: never;
|
|
160
|
+
header?: never;
|
|
161
|
+
path?: never;
|
|
162
|
+
cookie?: never;
|
|
163
|
+
};
|
|
164
|
+
requestBody?: never;
|
|
165
|
+
responses: {
|
|
166
|
+
/** @description The category list. */
|
|
167
|
+
200: {
|
|
168
|
+
headers: {
|
|
169
|
+
[name: string]: unknown;
|
|
170
|
+
};
|
|
171
|
+
content: {
|
|
172
|
+
"application/json": {
|
|
173
|
+
status?: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
podcastByFeedId: {
|
|
180
|
+
parameters: {
|
|
181
|
+
query: {
|
|
182
|
+
id: number;
|
|
183
|
+
};
|
|
184
|
+
header?: never;
|
|
185
|
+
path?: never;
|
|
186
|
+
cookie?: never;
|
|
187
|
+
};
|
|
188
|
+
requestBody?: never;
|
|
189
|
+
responses: {
|
|
190
|
+
/** @description One feed, or status false when it is unknown. */
|
|
191
|
+
200: {
|
|
192
|
+
headers: {
|
|
193
|
+
[name: string]: unknown;
|
|
194
|
+
};
|
|
195
|
+
content: {
|
|
196
|
+
"application/json": {
|
|
197
|
+
status?: string;
|
|
198
|
+
feed?: components["schemas"]["feed"];
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
podcastByFeedUrl: {
|
|
205
|
+
parameters: {
|
|
206
|
+
query: {
|
|
207
|
+
url: string;
|
|
208
|
+
};
|
|
209
|
+
header?: never;
|
|
210
|
+
path?: never;
|
|
211
|
+
cookie?: never;
|
|
212
|
+
};
|
|
213
|
+
requestBody?: never;
|
|
214
|
+
responses: {
|
|
215
|
+
/** @description One feed, or status false when it is unknown. */
|
|
216
|
+
200: {
|
|
217
|
+
headers: {
|
|
218
|
+
[name: string]: unknown;
|
|
219
|
+
};
|
|
220
|
+
content: {
|
|
221
|
+
"application/json": {
|
|
222
|
+
status?: string;
|
|
223
|
+
feed?: components["schemas"]["feed"];
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
searchPodcasts: {
|
|
230
|
+
parameters: {
|
|
231
|
+
query: {
|
|
232
|
+
q: string;
|
|
233
|
+
max?: number;
|
|
234
|
+
fulltext?: boolean;
|
|
235
|
+
};
|
|
236
|
+
header?: never;
|
|
237
|
+
path?: never;
|
|
238
|
+
cookie?: never;
|
|
239
|
+
};
|
|
240
|
+
requestBody?: never;
|
|
241
|
+
responses: {
|
|
242
|
+
/** @description Feeds matching the term in the title, author, or owner. */
|
|
243
|
+
200: {
|
|
244
|
+
headers: {
|
|
245
|
+
[name: string]: unknown;
|
|
246
|
+
};
|
|
247
|
+
content: {
|
|
248
|
+
"application/json": {
|
|
249
|
+
status?: string;
|
|
250
|
+
count?: number;
|
|
251
|
+
feeds?: components["schemas"]["feed"][];
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
episodesByFeedId: {
|
|
258
|
+
parameters: {
|
|
259
|
+
query: {
|
|
260
|
+
id: string;
|
|
261
|
+
since?: number;
|
|
262
|
+
max?: number;
|
|
263
|
+
fulltext?: boolean;
|
|
264
|
+
};
|
|
265
|
+
header?: never;
|
|
266
|
+
path?: never;
|
|
267
|
+
cookie?: never;
|
|
268
|
+
};
|
|
269
|
+
requestBody?: never;
|
|
270
|
+
responses: {
|
|
271
|
+
/** @description Episodes for one or more feed ids, newest first. max cannot exceed 1000. */
|
|
272
|
+
200: {
|
|
273
|
+
headers: {
|
|
274
|
+
[name: string]: unknown;
|
|
275
|
+
};
|
|
276
|
+
content: {
|
|
277
|
+
"application/json": {
|
|
278
|
+
status?: string;
|
|
279
|
+
count?: number;
|
|
280
|
+
items?: components["schemas"]["episode"][];
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
episodesByFeedUrl: {
|
|
287
|
+
parameters: {
|
|
288
|
+
query: {
|
|
289
|
+
url: string;
|
|
290
|
+
since?: number;
|
|
291
|
+
max?: number;
|
|
292
|
+
fulltext?: boolean;
|
|
293
|
+
};
|
|
294
|
+
header?: never;
|
|
295
|
+
path?: never;
|
|
296
|
+
cookie?: never;
|
|
297
|
+
};
|
|
298
|
+
requestBody?: never;
|
|
299
|
+
responses: {
|
|
300
|
+
/** @description Episodes for one feed URL, newest first. */
|
|
301
|
+
200: {
|
|
302
|
+
headers: {
|
|
303
|
+
[name: string]: unknown;
|
|
304
|
+
};
|
|
305
|
+
content: {
|
|
306
|
+
"application/json": {
|
|
307
|
+
status?: string;
|
|
308
|
+
count?: number;
|
|
309
|
+
items?: components["schemas"]["episode"][];
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,KAAK,GAAG;IAClB,kBAAkB,EAAE;QAClB,UAAU,EAAE;YACV,KAAK,CAAC,EAAE,KAAK,CAAC;YACd,MAAM,CAAC,EAAE,KAAK,CAAC;YACf,IAAI,CAAC,EAAE,KAAK,CAAC;YACb,MAAM,CAAC,EAAE,KAAK,CAAC;SAChB,CAAC;QACF,oDAAoD;QACpD,GAAG,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAClC,GAAG,CAAC,EAAE,KAAK,CAAC;QACZ,IAAI,CAAC,EAAE,KAAK,CAAC;QACb,MAAM,CAAC,EAAE,KAAK,CAAC;QACf,OAAO,CAAC,EAAE,KAAK,CAAC;QAChB,IAAI,CAAC,EAAE,KAA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AE,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;qBAC5C,CAAC;iBACH,CAAC;aACH,CAAC;SACH,CAAC;KACH,CAAC;IACF,iBAAiB,EAAE;QACjB,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,GAAG,EAAE,MAAM,CAAC;gBACZ,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,GAAG,CAAC,EAAE,MAAM,CAAC;gBACb,QAAQ,CAAC,EAAE,OAAO,CAAC;aACpB,CAAC;YACF,MAAM,CAAC,EAAE,KAAK,CAAC;YACf,IAAI,CAAC,EAAE,KAAK,CAAC;YACb,MAAM,CAAC,EAAE,KAAK,CAAC;SAChB,CAAC;QACF,WAAW,CAAC,EAAE,KAAK,CAAC;QACpB,SAAS,EAAE;YACT,4DAA4D;YAC5D,GAAG,EAAE;gBACH,OAAO,EAAE;oBACP,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;iBACzB,CAAC;gBACF,OAAO,EAAE;oBACP,kBAAkB,EAAE;wBAClB,MAAM,CAAC,EAAE,MAAM,CAAC;wBAChB,KAAK,CAAC,EAAE,MAAM,CAAC;wBACf,KAAK,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;qBAC5C,CAAC;iBACH,CAAC;aACH,CAAC;SACH,CAAC;KACH,CAAC;CACH"}
|
package/dist/openapi.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Generated from openapi.json. Do not edit. */
|
|
2
|
+
import type { BodyOf, Operation } from "@puppi/sdk";
|
|
3
|
+
import type { operations as spec } from "./openapi.js";
|
|
4
|
+
export type Api = {
|
|
5
|
+
responses: {
|
|
6
|
+
listCategories: BodyOf<spec["listCategories"]>;
|
|
7
|
+
podcastByFeedId: BodyOf<spec["podcastByFeedId"]>;
|
|
8
|
+
podcastByFeedUrl: BodyOf<spec["podcastByFeedUrl"]>;
|
|
9
|
+
searchPodcasts: BodyOf<spec["searchPodcasts"]>;
|
|
10
|
+
episodesByFeedId: BodyOf<spec["episodesByFeedId"]>;
|
|
11
|
+
episodesByFeedUrl: BodyOf<spec["episodesByFeedUrl"]>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const operations: Record<keyof Api["responses"], Operation>;
|
|
15
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,IAAI,IAAI,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,GAAG,GAAG;IAChB,SAAS,EAAE;QACT,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC/C,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACjD,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACnD,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC/C,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACnD,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;KACtD,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,WAAW,CAAC,EAAE,SAAS,CA+BhE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Generated from openapi.json. Do not edit. */
|
|
2
|
+
export const operations = {
|
|
3
|
+
listCategories: {
|
|
4
|
+
method: "get",
|
|
5
|
+
path: "/categories/list",
|
|
6
|
+
query: [],
|
|
7
|
+
},
|
|
8
|
+
podcastByFeedId: {
|
|
9
|
+
method: "get",
|
|
10
|
+
path: "/podcasts/byfeedid",
|
|
11
|
+
query: ["id"],
|
|
12
|
+
},
|
|
13
|
+
podcastByFeedUrl: {
|
|
14
|
+
method: "get",
|
|
15
|
+
path: "/podcasts/byfeedurl",
|
|
16
|
+
query: ["url"],
|
|
17
|
+
},
|
|
18
|
+
searchPodcasts: {
|
|
19
|
+
method: "get",
|
|
20
|
+
path: "/search/byterm",
|
|
21
|
+
query: ["q", "max", "fulltext"],
|
|
22
|
+
},
|
|
23
|
+
episodesByFeedId: {
|
|
24
|
+
method: "get",
|
|
25
|
+
path: "/episodes/byfeedid",
|
|
26
|
+
query: ["id", "since", "max", "fulltext"],
|
|
27
|
+
},
|
|
28
|
+
episodesByFeedUrl: {
|
|
29
|
+
method: "get",
|
|
30
|
+
path: "/episodes/byfeedurl",
|
|
31
|
+
query: ["url", "since", "max", "fulltext"],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAiBhD,MAAM,CAAC,MAAM,UAAU,GAA8C;IACnE,cAAc,EAAE;QACd,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,EAAE;KACV;IACD,eAAe,EAAE;QACf,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,CAAC,IAAI,CAAC;KACd;IACD,gBAAgB,EAAE;QAChB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,CAAC,KAAK,CAAC;KACf;IACD,cAAc,EAAE;QACd,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC;KAChC;IACD,gBAAgB,EAAE;QAChB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC;KAC1C;IACD,iBAAiB,EAAE;QACjB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC;KAC3C;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puppi/adapter-podcast-index",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Source connector for the Podcast Index API: signed API key, show lookup, episode pages.",
|
|
5
|
+
"homepage": "https://github.com/DashJump/puppi",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/DashJump/puppi/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/DashJump/puppi.git",
|
|
13
|
+
"directory": "connectors/podcast-index"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@puppi/sdk": "0.4.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@puppi/conformance": "0.1.0",
|
|
36
|
+
"@types/node": "^26.6.5",
|
|
37
|
+
"openapi-typescript": "7.13.0",
|
|
38
|
+
"typescript": "^5.6.3",
|
|
39
|
+
"vite-plus": "1.7.0"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=26"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"generate": "openapi-typescript openapi.json -o src/openapi.ts --export-type --root-types --empty-objects-unknown --default-non-nullable=false && puppi-write-operations openapi.json src/operations.ts",
|
|
46
|
+
"build": "tsc -p tsconfig.json",
|
|
47
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p test/tsconfig.json",
|
|
48
|
+
"test": "vp test run --config ../../vite.config.ts"
|
|
49
|
+
}
|
|
6
50
|
}
|