weekly-fifty 1.0.3 → 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 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,6 +47,12 @@ 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
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 }));
@@ -72,11 +79,7 @@ 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");
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,6 +17,12 @@ 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
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 }));
@@ -42,11 +49,7 @@ 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");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "license": "MIT",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "name": "weekly-fifty",
6
6
  "author": "Reuben Roessler",
7
7
  "repository": "rroessler/npm.weekly-fifty",
@@ -22,7 +22,7 @@
22
22
  "build": "tsup ./source/index.ts --dts --format esm,cjs",
23
23
  "// RELEASE //": "",
24
24
  "release": "run-s build release:np",
25
- "release:np": "np --no-tests --no-release-drafts --message 'v%s'"
25
+ "release:np": "np --no-tests --no-release-draft --message 'v%s'"
26
26
  },
27
27
  "dependencies": {
28
28
  "myzod": "^1.12.1"