distopia 0.2.1 → 0.3.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/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  let oxfmt = require("oxfmt");
4
4
  let oxlint = require("oxlint");
5
5
  //#region package.json
6
- var version = "0.2.1";
6
+ var version = "0.3.0";
7
7
  //#endregion
8
8
  //#region ../template/src/oxfmt.ts
9
9
  const config = (0, oxfmt.defineConfig)({
@@ -30,9 +30,27 @@ const config$1 = (0, oxlint.defineConfig)({
30
30
  ignorePatterns: ["*.auto.ts", "dist/**"]
31
31
  });
32
32
  //#endregion
33
+ //#region ../../src/infrastructure/http/src/safefetch.ts
34
+ async function safeFetch(input, init) {
35
+ return await fetch(input, init);
36
+ }
37
+ //#endregion
38
+ //#region ../../src/infrastructure/http/src/safeurl.ts
39
+ function safeUrl(strings, ...values) {
40
+ let result = "";
41
+ for (const [index, str] of strings.entries()) {
42
+ result += str;
43
+ const value = values[index];
44
+ if (value !== void 0) result += encodeURIComponent(value);
45
+ }
46
+ return result;
47
+ }
48
+ //#endregion
33
49
  //#region src/index.ts
34
50
  const DISTOPIA_VERSION = version;
35
51
  //#endregion
36
52
  exports.DISTOPIA_VERSION = DISTOPIA_VERSION;
37
53
  exports.oxfmtCfg = config;
38
54
  exports.oxlintCfg = config$1;
55
+ exports.safeFetch = safeFetch;
56
+ exports.safeUrl = safeUrl;
package/dist/index.d.cts CHANGED
@@ -24,7 +24,17 @@ declare const config$1: {
24
24
  ignorePatterns: string[];
25
25
  };
26
26
  //#endregion
27
+ //#region ../../src/infrastructure/http/src/safeurl.d.ts
28
+ type Branded<T, Brand> = T & {
29
+ readonly __brand: Brand;
30
+ };
31
+ type SafeUrl = Branded<string, "distopiaSafeUrl">;
32
+ declare function safeUrl(strings: TemplateStringsArray, ...values: (string | number)[]): SafeUrl;
33
+ //#endregion
34
+ //#region ../../src/infrastructure/http/src/safefetch.d.ts
35
+ declare function safeFetch(input: SafeUrl, init?: RequestInit): Promise<Response>;
36
+ //#endregion
27
37
  //#region src/index.d.ts
28
38
  declare const DISTOPIA_VERSION: string;
29
39
  //#endregion
30
- export { DISTOPIA_VERSION, config as oxfmtCfg, config$1 as oxlintCfg };
40
+ export { type Branded, DISTOPIA_VERSION, type SafeUrl, config as oxfmtCfg, config$1 as oxlintCfg, safeFetch, safeUrl };
package/dist/index.d.mts CHANGED
@@ -24,7 +24,17 @@ declare const config$1: {
24
24
  ignorePatterns: string[];
25
25
  };
26
26
  //#endregion
27
+ //#region ../../src/infrastructure/http/src/safeurl.d.ts
28
+ type Branded<T, Brand> = T & {
29
+ readonly __brand: Brand;
30
+ };
31
+ type SafeUrl = Branded<string, "distopiaSafeUrl">;
32
+ declare function safeUrl(strings: TemplateStringsArray, ...values: (string | number)[]): SafeUrl;
33
+ //#endregion
34
+ //#region ../../src/infrastructure/http/src/safefetch.d.ts
35
+ declare function safeFetch(input: SafeUrl, init?: RequestInit): Promise<Response>;
36
+ //#endregion
27
37
  //#region src/index.d.ts
28
38
  declare const DISTOPIA_VERSION: string;
29
39
  //#endregion
30
- export { DISTOPIA_VERSION, config as oxfmtCfg, config$1 as oxlintCfg };
40
+ export { type Branded, DISTOPIA_VERSION, type SafeUrl, config as oxfmtCfg, config$1 as oxlintCfg, safeFetch, safeUrl };
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { defineConfig } from "oxfmt";
3
3
  import { defineConfig as defineConfig$1 } from "oxlint";
4
4
  //#region package.json
5
- var version = "0.2.1";
5
+ var version = "0.3.0";
6
6
  //#endregion
7
7
  //#region ../template/src/oxfmt.ts
8
8
  const config = defineConfig({
@@ -29,7 +29,23 @@ const config$1 = defineConfig$1({
29
29
  ignorePatterns: ["*.auto.ts", "dist/**"]
30
30
  });
31
31
  //#endregion
32
+ //#region ../../src/infrastructure/http/src/safefetch.ts
33
+ async function safeFetch(input, init) {
34
+ return await fetch(input, init);
35
+ }
36
+ //#endregion
37
+ //#region ../../src/infrastructure/http/src/safeurl.ts
38
+ function safeUrl(strings, ...values) {
39
+ let result = "";
40
+ for (const [index, str] of strings.entries()) {
41
+ result += str;
42
+ const value = values[index];
43
+ if (value !== void 0) result += encodeURIComponent(value);
44
+ }
45
+ return result;
46
+ }
47
+ //#endregion
32
48
  //#region src/index.ts
33
49
  const DISTOPIA_VERSION = version;
34
50
  //#endregion
35
- export { DISTOPIA_VERSION, config as oxfmtCfg, config$1 as oxlintCfg };
51
+ export { DISTOPIA_VERSION, config as oxfmtCfg, config$1 as oxlintCfg, safeFetch, safeUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "distopia",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Library for Distopia.",
5
5
  "keywords": [
6
6
  "distopia",