demo-pkg-dalana 0.0.6 → 0.0.7
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.js +28 -0
- package/package.json +8 -2
- package/.../workspace/f/_core_/index.js +0 -25
- package/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc +0 -111
- package/index.ts +0 -1
- package/src/_internal/flagger/index.ts +0 -5
- package/src/_internal/index.ts +0 -13
- package/src/_internal/switchboard/index.ts +0 -70
- package/src/config/index.ts +0 -11
- package/src/digital-twin/index.ts +0 -4
- package/src/index.ts +0 -8
- package/src/utils/chrono.ts +0 -4
- package/src/utils/errors.ts +0 -0
- package/src/utils/index.ts +0 -0
- package/tsconfig.json +0 -29
- /package/{.../workspace/f/_core_ → dist}/index.d.ts +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/_internal/index.ts
|
|
2
|
+
async function init(options) {}
|
|
3
|
+
|
|
4
|
+
// src/config/index.ts
|
|
5
|
+
class Config {
|
|
6
|
+
static validate(schema) {
|
|
7
|
+
throw new Error("Not implemented");
|
|
8
|
+
}
|
|
9
|
+
static getConfig(key) {
|
|
10
|
+
throw new Error("Not implemented");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/digital-twin/index.ts
|
|
15
|
+
class DigitalTwin {
|
|
16
|
+
query() {}
|
|
17
|
+
mutate() {}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
await init();
|
|
22
|
+
export {
|
|
23
|
+
DigitalTwin,
|
|
24
|
+
Config
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//# debugId=8498BBF9C2B330A564756E2164756E21
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL19pbnRlcm5hbC9pbmRleC50cyIsICIuLi9zcmMvY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SBmcm9tIFwiLi9jb25maWdcIjtcbmltcG9ydCB7IERpZ2l0YWxUd2luIH0gZnJvbSBcIi4vZGlnaXRhbC10d2luXCI7XG5cbmF3YWl0IGluaXQoKTtcblxuZXhwb3J0IHsgQ29uZmlnLCBEaWdpdGFsVHdpbiB9OyIKICBdLAogICJtYXBwaW5ncyI6ICI7QUFZQSxlQUFzQixJQUFJLENBQUMsU0FBc0I7OztBQ1oxQyxNQUFNLE9BQU87QUFBQSxTQUVYLFFBQVEsQ0FBQyxRQUFpQjtBQUFBLElBRS9CLE1BQU0sSUFBSSxNQUFNLGlCQUFpQjtBQUFBO0FBQUEsU0FHNUIsU0FBUyxDQUFDLEtBQWE7QUFBQSxJQUM1QixNQUFNLElBQUksTUFBTSxpQkFBaUI7QUFBQTtBQUVyQzs7O0FDVk8sTUFBTSxZQUFZO0FBQUEsRUFDdkIsS0FBSyxHQUFHO0FBQUEsRUFDUixNQUFNLEdBQUc7QUFDWDs7O0FDRUEsTUFBTSxLQUFLOyIsCiAgImRlYnVnSWQiOiAiODQ5OEJCRjlDMkIzMzBBNTY0NzU2RTIxNjQ3NTZFMjEiLAogICJuYW1lcyI6IFtdCn0=
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "demo-pkg-dalana",
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.7",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@types/bun": "latest",
|
|
8
8
|
"bun-plugin-dts": "^0.3.0"
|
|
@@ -14,5 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"windmill-client": "^1.616.0"
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.md",
|
|
22
|
+
"package.json"
|
|
23
|
+
]
|
|
18
24
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/_internal/index.ts
|
|
2
|
-
async function init(options) {}
|
|
3
|
-
|
|
4
|
-
// src/config/index.ts
|
|
5
|
-
class Config {
|
|
6
|
-
static validate(schema) {
|
|
7
|
-
throw new Error("Not implemented");
|
|
8
|
-
}
|
|
9
|
-
static getConfig(key) {
|
|
10
|
-
throw new Error("Not implemented");
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// src/digital-twin/index.ts
|
|
15
|
-
class DigitalTwin {
|
|
16
|
-
query() {}
|
|
17
|
-
mutate() {}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
await init();
|
|
22
|
-
export {
|
|
23
|
-
DigitalTwin,
|
|
24
|
-
Config
|
|
25
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Use Bun instead of Node.js, npm, pnpm, or vite.
|
|
3
|
-
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
Default to using Bun instead of Node.js.
|
|
8
|
-
|
|
9
|
-
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
|
|
10
|
-
- Use `bun test` instead of `jest` or `vitest`
|
|
11
|
-
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
|
|
12
|
-
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
|
|
13
|
-
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
|
|
14
|
-
- Use `bunx <package> <command>` instead of `npx <package> <command>`
|
|
15
|
-
- Bun automatically loads .env, so don't use dotenv.
|
|
16
|
-
|
|
17
|
-
## APIs
|
|
18
|
-
|
|
19
|
-
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
|
|
20
|
-
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
|
|
21
|
-
- `Bun.redis` for Redis. Don't use `ioredis`.
|
|
22
|
-
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
|
|
23
|
-
- `WebSocket` is built-in. Don't use `ws`.
|
|
24
|
-
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
|
|
25
|
-
- Bun.$`ls` instead of execa.
|
|
26
|
-
|
|
27
|
-
## Testing
|
|
28
|
-
|
|
29
|
-
Use `bun test` to run tests.
|
|
30
|
-
|
|
31
|
-
```ts#index.test.ts
|
|
32
|
-
import { test, expect } from "bun:test";
|
|
33
|
-
|
|
34
|
-
test("hello world", () => {
|
|
35
|
-
expect(1).toBe(1);
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Frontend
|
|
40
|
-
|
|
41
|
-
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
|
|
42
|
-
|
|
43
|
-
Server:
|
|
44
|
-
|
|
45
|
-
```ts#index.ts
|
|
46
|
-
import index from "./index.html"
|
|
47
|
-
|
|
48
|
-
Bun.serve({
|
|
49
|
-
routes: {
|
|
50
|
-
"/": index,
|
|
51
|
-
"/api/users/:id": {
|
|
52
|
-
GET: (req) => {
|
|
53
|
-
return new Response(JSON.stringify({ id: req.params.id }));
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
// optional websocket support
|
|
58
|
-
websocket: {
|
|
59
|
-
open: (ws) => {
|
|
60
|
-
ws.send("Hello, world!");
|
|
61
|
-
},
|
|
62
|
-
message: (ws, message) => {
|
|
63
|
-
ws.send(message);
|
|
64
|
-
},
|
|
65
|
-
close: (ws) => {
|
|
66
|
-
// handle close
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
development: {
|
|
70
|
-
hmr: true,
|
|
71
|
-
console: true,
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
|
|
77
|
-
|
|
78
|
-
```html#index.html
|
|
79
|
-
<html>
|
|
80
|
-
<body>
|
|
81
|
-
<h1>Hello, world!</h1>
|
|
82
|
-
<script type="module" src="./frontend.tsx"></script>
|
|
83
|
-
</body>
|
|
84
|
-
</html>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
With the following `frontend.tsx`:
|
|
88
|
-
|
|
89
|
-
```tsx#frontend.tsx
|
|
90
|
-
import React from "react";
|
|
91
|
-
import { createRoot } from "react-dom/client";
|
|
92
|
-
|
|
93
|
-
// import .css files directly and it works
|
|
94
|
-
import './index.css';
|
|
95
|
-
|
|
96
|
-
const root = createRoot(document.body);
|
|
97
|
-
|
|
98
|
-
export default function Frontend() {
|
|
99
|
-
return <h1>Hello, world!</h1>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
root.render(<Frontend />);
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Then, run index.ts
|
|
106
|
-
|
|
107
|
-
```sh
|
|
108
|
-
bun --hot ./index.ts
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.
|
package/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/index.ts";
|
package/src/_internal/index.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export interface HttpCallbackPayload {
|
|
2
|
-
body?: string;
|
|
3
|
-
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
4
|
-
headers?: Record<string, string>;
|
|
5
|
-
url: string;
|
|
6
|
-
callbacks: {
|
|
7
|
-
onSuccess: string;
|
|
8
|
-
onError?: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface RegisterEventCallbackPayload {
|
|
13
|
-
source: string;
|
|
14
|
-
filter: Record<string, unknown>;
|
|
15
|
-
url: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class Switchboard {
|
|
19
|
-
|
|
20
|
-
constructor(private baseUrl: string) {}
|
|
21
|
-
// will do the requested http call and call the success or failure callbacks with the response
|
|
22
|
-
async registerHttpCallback(payload: HttpCallbackPayload): Promise<void> {
|
|
23
|
-
const response = await fetch(`${this.baseUrl}/proxy`, {
|
|
24
|
-
method: "POST",
|
|
25
|
-
headers: { "Content-Type": "application/json" },
|
|
26
|
-
body: JSON.stringify(payload),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
if (!response.ok) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
`Failed to register http callback: ${response.statusText}`,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// will register an event listener for the given event filter returns a context id
|
|
37
|
-
async registerEventCallback(
|
|
38
|
-
payload: RegisterEventCallbackPayload,
|
|
39
|
-
): Promise<string> {
|
|
40
|
-
const response = await fetch(`${this.baseUrl}/register_event_handler`, {
|
|
41
|
-
method: "POST",
|
|
42
|
-
headers: { "Content-Type": "application/json" },
|
|
43
|
-
body: JSON.stringify(payload),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (!response.ok) {
|
|
47
|
-
throw new Error(
|
|
48
|
-
`Failed to register event callback: ${response.statusText}`,
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const data = (await response.json()) as { contextId: string };
|
|
53
|
-
return data.contextId;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// will deregister the event listener for the given context id
|
|
57
|
-
async deregisterEventCallback(contextId: string): Promise<void> {
|
|
58
|
-
const response = await fetch(`${this.baseUrl}/deregister_event_handler`, {
|
|
59
|
-
method: "POST",
|
|
60
|
-
headers: { "Content-Type": "application/json" },
|
|
61
|
-
body: JSON.stringify({ contextId }),
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (!response.ok) {
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Failed to deregister event callback: ${response.statusText}`,
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
package/src/config/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export class Config {
|
|
2
|
-
// validate and ensure the config schema is resolvable within the current context
|
|
3
|
-
static validate(schema: unknown) {
|
|
4
|
-
// call flagger with schema and current context
|
|
5
|
-
throw new Error("Not implemented");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
static getConfig(key: string) {
|
|
9
|
-
throw new Error("Not implemented");
|
|
10
|
-
}
|
|
11
|
-
}
|
package/src/index.ts
DELETED
package/src/utils/chrono.ts
DELETED
package/src/utils/errors.ts
DELETED
|
File without changes
|
package/src/utils/index.ts
DELETED
|
File without changes
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
// Environment setup & latest features
|
|
4
|
-
"lib": ["ESNext"],
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"module": "Preserve",
|
|
7
|
-
"moduleDetection": "force",
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
|
|
11
|
-
// Bundler mode
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"allowImportingTsExtensions": true,
|
|
14
|
-
"verbatimModuleSyntax": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
|
|
17
|
-
// Best practices
|
|
18
|
-
"strict": true,
|
|
19
|
-
"skipLibCheck": true,
|
|
20
|
-
"noFallthroughCasesInSwitch": true,
|
|
21
|
-
"noUncheckedIndexedAccess": true,
|
|
22
|
-
"noImplicitOverride": true,
|
|
23
|
-
|
|
24
|
-
// Some stricter flags (disabled by default)
|
|
25
|
-
"noUnusedLocals": false,
|
|
26
|
-
"noUnusedParameters": false,
|
|
27
|
-
"noPropertyAccessFromIndexSignature": false
|
|
28
|
-
}
|
|
29
|
-
}
|
|
File without changes
|