monoidentity 0.15.0 → 0.15.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.
@@ -1,2 +1,2 @@
1
- import type { Bucket } from "../utils-bucket.js";
1
+ import type { Bucket } from "../utils-transport.js";
2
2
  export declare const backupCloud: (shouldBackup: (path: string) => boolean, bucket: Bucket) => Promise<void>;
@@ -1,4 +1,8 @@
1
- import type { Bucket } from "./utils-bucket.js";
1
+ export type Bucket = {
2
+ base: string;
3
+ accessKeyId: string;
4
+ secretAccessKey: string;
5
+ };
2
6
  export type Intent = {
3
7
  storage: true;
4
8
  } | {
@@ -0,0 +1,4 @@
1
+ declare namespace _default {
2
+ function fetch(request: any): Promise<Response>;
3
+ }
4
+ export default _default;
@@ -0,0 +1,35 @@
1
+ // @ts-nocheck
2
+
3
+ export default {
4
+ async fetch(request) {
5
+ const target = request.headers.get("x-proxy-target");
6
+ if (!target) {
7
+ return new Response("Missing x-proxy-target header", { status: 400 });
8
+ }
9
+
10
+ try {
11
+ const targetUrl = new URL(target);
12
+ if (
13
+ targetUrl.protocol != "https:" ||
14
+ !targetUrl.host.endsWith("-psv.edupoint.com") ||
15
+ targetUrl.pathname != "/Service/PXPCommunication.asmx/ProcessWebServiceRequest"
16
+ ) {
17
+ throw new Error();
18
+ }
19
+ } catch {
20
+ return new Response("Invalid target URL", { status: 400 });
21
+ }
22
+
23
+ const newHeaders = new Headers(request.headers);
24
+ newHeaders.delete("x-proxy-target");
25
+ newHeaders.delete("host");
26
+
27
+ const newRequest = new Request(target, {
28
+ method: request.method,
29
+ headers: newHeaders,
30
+ body: request.body,
31
+ });
32
+
33
+ return fetch(newRequest);
34
+ },
35
+ };
@@ -1,15 +1,12 @@
1
- import { parse, stringify } from "devalue";
2
-
3
1
  //#region src/lib/verification/attest.remote.ts
4
2
  async function attest_remote_default(arg, init) {
5
- const res = await fetch("https://benignmonoserver.fly.dev/b1c8ae45b4", {
3
+ const res = await fetch("https://benignmonoserver.fly.dev/attest:c5", {
6
4
  method: "POST",
7
- body: stringify(arg),
5
+ body: JSON.stringify(arg),
8
6
  ...init
9
7
  });
10
8
  if (!res.ok) throw new Error(await res.text());
11
- if (!res.headers.get("content-type")?.includes("application/json")) return res;
12
- return parse(await res.text());
9
+ return await res.json();
13
10
  }
14
11
 
15
12
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoidentity",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "repository": "KTibow/monoidentity",
5
5
  "author": {
6
6
  "name": "KTibow"
@@ -42,9 +42,9 @@
42
42
  "@sveltejs/package": "^2.5.4",
43
43
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
44
44
  "@types/wicg-file-system-access": "^2023.10.6",
45
- "fast-xml-parser": "^5.2.5",
45
+ "fast-studentvue": "^2.0.1",
46
46
  "knip": "^5.64.1",
47
- "monoserve": "^2.2.0",
47
+ "monoserve": "^3.2.0",
48
48
  "publint": "^0.3.13",
49
49
  "rolldown": "1.0.0-beta.40",
50
50
  "school-districts": "^2.0.0",
@@ -1,7 +0,0 @@
1
- export type Bucket = {
2
- base: string;
3
- accessKeyId: string;
4
- secretAccessKey: string;
5
- };
6
- export declare const encodeBucket: (bucket: Bucket) => string;
7
- export declare const decodeBucket: (data: string) => Bucket;
@@ -1,7 +0,0 @@
1
- import { encode, decode } from "./utils-base36.js";
2
- export const encodeBucket = (bucket) => {
3
- return encode(JSON.stringify(bucket));
4
- };
5
- export const decodeBucket = (data) => {
6
- return JSON.parse(decode(data));
7
- };
@@ -1,6 +0,0 @@
1
- declare const _default: ({ base, userID, password }: {
2
- base: string;
3
- userID: string;
4
- password: string;
5
- }, name: string, params?: Record<string, string>) => Promise<any>;
6
- export default _default;
@@ -1,45 +0,0 @@
1
- import { XMLParser } from "fast-xml-parser";
2
- const build = (object) => {
3
- const params = new URLSearchParams();
4
- for (const [key, value] of Object.entries(object)) {
5
- params.set(key, value);
6
- }
7
- return params;
8
- };
9
- const parser = new XMLParser({ ignoreAttributes: false });
10
- export default async ({ base, userID, password }, name, params = {}) => {
11
- const request = build({
12
- userID,
13
- password,
14
- skipLoginLog: "true",
15
- parent: "false",
16
- webServiceHandleName: "PXPWebServices",
17
- methodName: name,
18
- paramStr: `<Parms>${Object.keys(params)
19
- .map((key) => `<${key}>${params[key]}</${key}>`)
20
- .join("")}</Parms>`,
21
- });
22
- const response = await fetch(`${base}/Service/PXPCommunication.asmx/ProcessWebServiceRequest`, {
23
- method: "POST",
24
- body: request,
25
- headers: {
26
- "content-type": "application/x-www-form-urlencoded",
27
- },
28
- });
29
- const dataWrap = await response.text();
30
- const data = dataWrap
31
- .split(`<string xmlns="http://edupoint.com/webservices/">`)[1]
32
- .split("</string>")[0]
33
- .replace(/&amp;/g, "&")
34
- .replace(/&lt;/g, "<")
35
- .replace(/&gt;/g, ">");
36
- const xml = parser.parse(data);
37
- const err = xml.RT_ERROR;
38
- if (err) {
39
- if (err["@_ERROR_MESSAGE"].startsWith("Invalid user id or password")) {
40
- throw new Error("Invalid auth");
41
- }
42
- throw new Error("StudentVue error");
43
- }
44
- return xml;
45
- };