zitejs 0.10.0-start.24 → 0.10.0-start.26

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.
Files changed (36) hide show
  1. package/dist/cjs/dev/signin.d.ts +2 -2
  2. package/dist/cjs/dev/signin.js +5 -5
  3. package/dist/cjs/start/provider.d.ts +8 -6
  4. package/dist/cjs/start/provider.js +98 -37
  5. package/dist/cjs/start/types.d.ts +54 -10
  6. package/dist/esm/dev/signin.d.ts +2 -2
  7. package/dist/esm/dev/signin.js +6 -6
  8. package/dist/esm/signin/conformance.js +1 -1
  9. package/dist/esm/signin/keys.d.ts +3 -7
  10. package/dist/esm/signin/keys.js +4 -10
  11. package/dist/esm/start/direct.d.ts +3 -3
  12. package/dist/esm/start/direct.js +14 -16
  13. package/dist/esm/start/index.d.ts +1 -1
  14. package/dist/esm/start/pageHead.d.ts +3 -3
  15. package/dist/esm/start/pageHead.js +3 -8
  16. package/dist/esm/start/provider.d.ts +8 -6
  17. package/dist/esm/start/provider.js +96 -35
  18. package/dist/esm/start/sdk/axios.d.ts +76 -0
  19. package/dist/esm/start/sdk/axios.js +210 -0
  20. package/dist/esm/start/sdk/nodeFetch.d.ts +41 -0
  21. package/dist/esm/start/sdk/nodeFetch.js +33 -0
  22. package/dist/esm/start/sdk/undici.d.ts +34 -0
  23. package/dist/esm/start/sdk/undici.js +18 -0
  24. package/dist/esm/start/sdkPatches.d.ts +22 -0
  25. package/dist/esm/start/sdkPatches.js +359 -0
  26. package/dist/esm/start/server.d.ts +3 -3
  27. package/dist/esm/start/server.js +17 -18
  28. package/dist/esm/start/types.d.ts +54 -10
  29. package/dist/esm/start/version.d.ts +1 -1
  30. package/dist/esm/start/version.js +1 -1
  31. package/dist/esm/start/vite.js +2 -0
  32. package/package.json +2 -1
  33. package/dist/cjs/internal/appToken.d.ts +0 -17
  34. package/dist/cjs/internal/appToken.js +0 -26
  35. package/dist/esm/internal/appToken.d.ts +0 -17
  36. package/dist/esm/internal/appToken.js +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.10.0-start.24",
3
+ "version": "0.10.0-start.26",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -142,6 +142,7 @@
142
142
  "build": "node scripts/write-version.mjs && tsc && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
143
143
  "test": "vitest run",
144
144
  "test:start": "node tests/start/run-contract.mjs",
145
+ "test:start:sdk": "node tests/start/sdk/run.mjs",
145
146
  "test:watch": "vitest",
146
147
  "typecheck": "tsc --noEmit",
147
148
  "version": "node scripts/write-version.mjs && git add src/start/version.ts",
@@ -1,17 +0,0 @@
1
- /** The claims zitejs reads from its own app token. It never verifies one: the platform does, and zitejs only reads what it was handed. */
2
- export type AppTokenClaims = {
3
- /** Seconds since the epoch. */
4
- exp: number;
5
- app?: string;
6
- /** The build it was minted for; a dev token's is the app's newest. */
7
- build?: number;
8
- base?: string | null;
9
- mode?: string;
10
- /** The org's settings version the token was minted under. */
11
- ver?: number | null;
12
- /** Whether the org's plan shows Zite's badge. */
13
- branding?: boolean;
14
- appUrl?: string | null;
15
- };
16
- /** The token's payload, or undefined for anything that isn't one. */
17
- export declare const appTokenClaims: (token: string) => AppTokenClaims | undefined;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- // Isomorphic: the upload client reads the app id from it too.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.appTokenClaims = void 0;
5
- const PREFIX = "zite_app_v1.";
6
- const decodeSegment = (segment) => {
7
- const base64 = segment.replace(/-/g, "+").replace(/_/g, "/");
8
- const bytes = Uint8Array.from(atob(base64 + "=".repeat((4 - (base64.length % 4)) % 4)), (c) => c.charCodeAt(0));
9
- return JSON.parse(new TextDecoder().decode(bytes));
10
- };
11
- /** The token's payload, or undefined for anything that isn't one. */
12
- const appTokenClaims = (token) => {
13
- if (!token.startsWith(PREFIX))
14
- return undefined;
15
- const payload = token.slice(PREFIX.length).split(".")[1];
16
- if (!payload)
17
- return undefined;
18
- try {
19
- const claims = decodeSegment(payload);
20
- return claims && typeof claims.exp === "number" ? claims : undefined;
21
- }
22
- catch {
23
- return undefined;
24
- }
25
- };
26
- exports.appTokenClaims = appTokenClaims;
@@ -1,17 +0,0 @@
1
- /** The claims zitejs reads from its own app token. It never verifies one: the platform does, and zitejs only reads what it was handed. */
2
- export type AppTokenClaims = {
3
- /** Seconds since the epoch. */
4
- exp: number;
5
- app?: string;
6
- /** The build it was minted for; a dev token's is the app's newest. */
7
- build?: number;
8
- base?: string | null;
9
- mode?: string;
10
- /** The org's settings version the token was minted under. */
11
- ver?: number | null;
12
- /** Whether the org's plan shows Zite's badge. */
13
- branding?: boolean;
14
- appUrl?: string | null;
15
- };
16
- /** The token's payload, or undefined for anything that isn't one. */
17
- export declare const appTokenClaims: (token: string) => AppTokenClaims | undefined;
@@ -1,22 +0,0 @@
1
- // Isomorphic: the upload client reads the app id from it too.
2
- const PREFIX = "zite_app_v1.";
3
- const decodeSegment = (segment) => {
4
- const base64 = segment.replace(/-/g, "+").replace(/_/g, "/");
5
- const bytes = Uint8Array.from(atob(base64 + "=".repeat((4 - (base64.length % 4)) % 4)), (c) => c.charCodeAt(0));
6
- return JSON.parse(new TextDecoder().decode(bytes));
7
- };
8
- /** The token's payload, or undefined for anything that isn't one. */
9
- export const appTokenClaims = (token) => {
10
- if (!token.startsWith(PREFIX))
11
- return undefined;
12
- const payload = token.slice(PREFIX.length).split(".")[1];
13
- if (!payload)
14
- return undefined;
15
- try {
16
- const claims = decodeSegment(payload);
17
- return claims && typeof claims.exp === "number" ? claims : undefined;
18
- }
19
- catch {
20
- return undefined;
21
- }
22
- };