weekly-fifty 1.0.2 → 1.0.4
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/dist/index.cjs +13 -7
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +13 -7
- package/package.json +2 -5
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,8 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
// source/_exports.ts
|
|
38
38
|
var exports_exports = {};
|
|
39
39
|
__export(exports_exports, {
|
|
40
|
-
Fetch: () => Fetch
|
|
40
|
+
Fetch: () => Fetch,
|
|
41
|
+
URL: () => URL
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
// source/fetch/index.ts
|
|
@@ -46,8 +47,14 @@ async function Fetch(options = {}) {
|
|
|
46
47
|
const { url, parse } = Fetch.Options(options);
|
|
47
48
|
return fetch(url).then(parse);
|
|
48
49
|
}
|
|
50
|
+
function URL() {
|
|
51
|
+
return "https://weeklyfifty-7617b.web.app/api";
|
|
52
|
+
}
|
|
53
|
+
((URL2) => {
|
|
54
|
+
URL2.Latest = () => `${URL2()}/getLatestQuiz`;
|
|
55
|
+
})(URL || (URL = {}));
|
|
49
56
|
((Fetch2) => {
|
|
50
|
-
const m_timestamp = import_myzod.default.object({ _seconds: import_myzod.default.required(import_myzod.default.number()), _nanoseconds: import_myzod.default.required(import_myzod.default.number()) }, { allowUnknown: true }).map(({ _seconds, _nanoseconds }) => new Date(_seconds * 1e3 + _nanoseconds
|
|
57
|
+
const m_timestamp = import_myzod.default.object({ _seconds: import_myzod.default.required(import_myzod.default.number()), _nanoseconds: import_myzod.default.required(import_myzod.default.number()) }, { allowUnknown: true }).map(({ _seconds, _nanoseconds }) => new Date(_seconds * 1e3 + _nanoseconds / 1e6));
|
|
51
58
|
const m_question = import_myzod.default.object({ qTitle: import_myzod.default.required(import_myzod.default.string()), qAnswer: import_myzod.default.required(import_myzod.default.string()) }, { allowUnknown: true }).map(({ qTitle, qAnswer }) => ({ title: qTitle, answer: qAnswer }));
|
|
52
59
|
const m_quiz = import_myzod.default.object(
|
|
53
60
|
{
|
|
@@ -72,17 +79,16 @@ async function Fetch(options = {}) {
|
|
|
72
79
|
notes: { above: api.notesAbove, below: api.notesBelow }
|
|
73
80
|
})
|
|
74
81
|
);
|
|
75
|
-
Fetch2.Options = (options = {}) => ({
|
|
76
|
-
url: "https://weeklyfifty-7617b.web.app/api/getLatestQuiz",
|
|
77
|
-
parse: m_parse,
|
|
78
|
-
...options
|
|
79
|
-
});
|
|
82
|
+
Fetch2.Options = (options = {}) => ({ url: URL(), parse: m_parse, ...options });
|
|
80
83
|
const m_parse = async (response) => {
|
|
81
84
|
const ct = response.headers.get("content-type");
|
|
82
85
|
if (ct && ct.indexOf("application/json") === -1) throw new TypeError("Expected JSON response");
|
|
83
86
|
return response.json().then((data) => m_quiz.parse(data));
|
|
84
87
|
};
|
|
85
88
|
})(Fetch || (Fetch = {}));
|
|
89
|
+
|
|
90
|
+
// source/index.ts
|
|
91
|
+
Fetch().then((quiz) => console.log(quiz.creation));
|
|
86
92
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
93
|
0 && (module.exports = {
|
|
88
94
|
TW50
|
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,12 @@ interface Quiz {
|
|
|
19
19
|
readonly questions: ReadonlyArray<Question>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/** The baseline quiz URL. */
|
|
23
|
+
declare function URL(): string;
|
|
24
|
+
declare namespace URL {
|
|
25
|
+
/** The latest quiz URL. */
|
|
26
|
+
const Latest: () => string;
|
|
27
|
+
}
|
|
22
28
|
/** Handles Fetching Quizzes. */
|
|
23
29
|
declare function Fetch(options?: Fetch.Options): Promise<Quiz>;
|
|
24
30
|
declare namespace Fetch {
|
|
@@ -41,8 +47,9 @@ declare const _exports_Fetch: typeof Fetch;
|
|
|
41
47
|
type _exports_Notes = Notes;
|
|
42
48
|
type _exports_Question = Question;
|
|
43
49
|
type _exports_Quiz = Quiz;
|
|
50
|
+
declare const _exports_URL: typeof URL;
|
|
44
51
|
declare namespace _exports {
|
|
45
|
-
export { _exports_Fetch as Fetch, type _exports_Notes as Notes, type _exports_Question as Question, type _exports_Quiz as Quiz };
|
|
52
|
+
export { _exports_Fetch as Fetch, type _exports_Notes as Notes, type _exports_Question as Question, type _exports_Quiz as Quiz, _exports_URL as URL };
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
export { _exports as TW50 };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ interface Quiz {
|
|
|
19
19
|
readonly questions: ReadonlyArray<Question>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/** The baseline quiz URL. */
|
|
23
|
+
declare function URL(): string;
|
|
24
|
+
declare namespace URL {
|
|
25
|
+
/** The latest quiz URL. */
|
|
26
|
+
const Latest: () => string;
|
|
27
|
+
}
|
|
22
28
|
/** Handles Fetching Quizzes. */
|
|
23
29
|
declare function Fetch(options?: Fetch.Options): Promise<Quiz>;
|
|
24
30
|
declare namespace Fetch {
|
|
@@ -41,8 +47,9 @@ declare const _exports_Fetch: typeof Fetch;
|
|
|
41
47
|
type _exports_Notes = Notes;
|
|
42
48
|
type _exports_Question = Question;
|
|
43
49
|
type _exports_Quiz = Quiz;
|
|
50
|
+
declare const _exports_URL: typeof URL;
|
|
44
51
|
declare namespace _exports {
|
|
45
|
-
export { _exports_Fetch as Fetch, type _exports_Notes as Notes, type _exports_Question as Question, type _exports_Quiz as Quiz };
|
|
52
|
+
export { _exports_Fetch as Fetch, type _exports_Notes as Notes, type _exports_Question as Question, type _exports_Quiz as Quiz, _exports_URL as URL };
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
export { _exports as TW50 };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,8 @@ var __export = (target, all) => {
|
|
|
7
7
|
// source/_exports.ts
|
|
8
8
|
var exports_exports = {};
|
|
9
9
|
__export(exports_exports, {
|
|
10
|
-
Fetch: () => Fetch
|
|
10
|
+
Fetch: () => Fetch,
|
|
11
|
+
URL: () => URL
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
// source/fetch/index.ts
|
|
@@ -16,8 +17,14 @@ async function Fetch(options = {}) {
|
|
|
16
17
|
const { url, parse } = Fetch.Options(options);
|
|
17
18
|
return fetch(url).then(parse);
|
|
18
19
|
}
|
|
20
|
+
function URL() {
|
|
21
|
+
return "https://weeklyfifty-7617b.web.app/api";
|
|
22
|
+
}
|
|
23
|
+
((URL2) => {
|
|
24
|
+
URL2.Latest = () => `${URL2()}/getLatestQuiz`;
|
|
25
|
+
})(URL || (URL = {}));
|
|
19
26
|
((Fetch2) => {
|
|
20
|
-
const m_timestamp = z.object({ _seconds: z.required(z.number()), _nanoseconds: z.required(z.number()) }, { allowUnknown: true }).map(({ _seconds, _nanoseconds }) => new Date(_seconds * 1e3 + _nanoseconds
|
|
27
|
+
const m_timestamp = z.object({ _seconds: z.required(z.number()), _nanoseconds: z.required(z.number()) }, { allowUnknown: true }).map(({ _seconds, _nanoseconds }) => new Date(_seconds * 1e3 + _nanoseconds / 1e6));
|
|
21
28
|
const m_question = z.object({ qTitle: z.required(z.string()), qAnswer: z.required(z.string()) }, { allowUnknown: true }).map(({ qTitle, qAnswer }) => ({ title: qTitle, answer: qAnswer }));
|
|
22
29
|
const m_quiz = z.object(
|
|
23
30
|
{
|
|
@@ -42,17 +49,16 @@ async function Fetch(options = {}) {
|
|
|
42
49
|
notes: { above: api.notesAbove, below: api.notesBelow }
|
|
43
50
|
})
|
|
44
51
|
);
|
|
45
|
-
Fetch2.Options = (options = {}) => ({
|
|
46
|
-
url: "https://weeklyfifty-7617b.web.app/api/getLatestQuiz",
|
|
47
|
-
parse: m_parse,
|
|
48
|
-
...options
|
|
49
|
-
});
|
|
52
|
+
Fetch2.Options = (options = {}) => ({ url: URL(), parse: m_parse, ...options });
|
|
50
53
|
const m_parse = async (response) => {
|
|
51
54
|
const ct = response.headers.get("content-type");
|
|
52
55
|
if (ct && ct.indexOf("application/json") === -1) throw new TypeError("Expected JSON response");
|
|
53
56
|
return response.json().then((data) => m_quiz.parse(data));
|
|
54
57
|
};
|
|
55
58
|
})(Fetch || (Fetch = {}));
|
|
59
|
+
|
|
60
|
+
// source/index.ts
|
|
61
|
+
Fetch().then((quiz) => console.log(quiz.creation));
|
|
56
62
|
export {
|
|
57
63
|
exports_exports as TW50
|
|
58
64
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"name": "weekly-fifty",
|
|
6
6
|
"author": "Reuben Roessler",
|
|
7
7
|
"repository": "rroessler/npm.weekly-fifty",
|
|
@@ -20,11 +20,9 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"// BUILD //": "",
|
|
22
22
|
"build": "tsup ./source/index.ts --dts --format esm,cjs",
|
|
23
|
-
"// TEST //": "",
|
|
24
|
-
"test": "",
|
|
25
23
|
"// RELEASE //": "",
|
|
26
24
|
"release": "run-s build release:np",
|
|
27
|
-
"release:np": "np"
|
|
25
|
+
"release:np": "np --no-tests --no-release-draft --message 'v%s'"
|
|
28
26
|
},
|
|
29
27
|
"dependencies": {
|
|
30
28
|
"myzod": "^1.12.1"
|
|
@@ -34,7 +32,6 @@
|
|
|
34
32
|
"np": "^10.2.0",
|
|
35
33
|
"npm-run-all2": "^8.0.4",
|
|
36
34
|
"tsup": "^8.5.1",
|
|
37
|
-
"tsx": "^4.20.6",
|
|
38
35
|
"typescript": "^5.9.3"
|
|
39
36
|
}
|
|
40
37
|
}
|