@stnd/core 0.1.0 → 0.22.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.
- package/LICENSE +21 -0
- package/README.md +239 -0
- package/package.json +90 -12
- package/src/dev-toolbar/debug-toggle.js +21 -0
- package/src/dev-toolbar/lab-toggle.js +153 -0
- package/src/loader.js +681 -0
- package/src/virtual.js +440 -0
- package/src/virtual.test.js +37 -0
- package/standard.js +545 -0
- package/CHANGELOG.md +0 -13
- package/src/StandardModel.ts +0 -55
- package/src/StandardRoot.ts +0 -73
- package/src/Visitor.ts +0 -50
- package/src/index.ts +0 -4
- package/tsconfig.json +0 -20
package/src/Visitor.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import Log from "@stnd/log";
|
|
2
|
-
import type { StandardRoot } from "./StandardRoot.js";
|
|
3
|
-
import type { APIContext } from "astro";
|
|
4
|
-
|
|
5
|
-
const log = Log({ scope: "Visitor" });
|
|
6
|
-
|
|
7
|
-
export interface VisitorData {
|
|
8
|
-
id: number;
|
|
9
|
-
username?: string;
|
|
10
|
-
email?: string;
|
|
11
|
-
role?: string;
|
|
12
|
-
tier?: string;
|
|
13
|
-
isAnonymous?: boolean;
|
|
14
|
-
preferences?: any;
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default class Visitor {
|
|
19
|
-
public raw: VisitorData;
|
|
20
|
-
protected root?: StandardRoot;
|
|
21
|
-
|
|
22
|
-
constructor(raw: VisitorData, root?: StandardRoot) {
|
|
23
|
-
this.raw = raw;
|
|
24
|
-
this.root = root;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* FACTORY: Create a Visitor within the Root context
|
|
29
|
-
* This is a stub implementation that should be overridden or improved
|
|
30
|
-
* by the specific app implementation if needed, but here we provide
|
|
31
|
-
* the basic "Anonymous" or "Auth" structure.
|
|
32
|
-
*/
|
|
33
|
-
static async fromUrl(root: StandardRoot, context: APIContext): Promise<Visitor> {
|
|
34
|
-
// Basic implementation for now - defaulting to Anonymous
|
|
35
|
-
// The full auth logic involves DB access which we can add later
|
|
36
|
-
// or we can copy the logic from the app.
|
|
37
|
-
// For now, let's keep it simple to get the structure right.
|
|
38
|
-
|
|
39
|
-
const { cookies } = context;
|
|
40
|
-
// Real implementation would check session/jwt here.
|
|
41
|
-
|
|
42
|
-
// Return anonymous visitor
|
|
43
|
-
return new Visitor({
|
|
44
|
-
id: 1,
|
|
45
|
-
username: "anonymous",
|
|
46
|
-
tier: "anonymous",
|
|
47
|
-
isAnonymous: true
|
|
48
|
-
}, root);
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"resolveJsonModule": true,
|
|
7
|
-
"isolatedModules": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"skipLibCheck": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"src/**/*"
|
|
15
|
-
],
|
|
16
|
-
"exclude": [
|
|
17
|
-
"node_modules",
|
|
18
|
-
"dist"
|
|
19
|
-
]
|
|
20
|
-
}
|