@luckystack/devkit 0.12.1 → 0.14.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.
@@ -37,7 +37,8 @@ export interface ApiParams {
37
37
  flushPressure: (options?: { thresholdBytes?: number }) => Promise<void>;
38
38
  }
39
39
 
40
- export const main = ({ }: ApiParams): MaybePromise<ApiResponse> => {
40
+ // Take what you need from the parameters, e.g. ({ data, user, functions }: ApiParams)
41
+ export const main = (): MaybePromise<ApiResponse> => {
41
42
  // Stream payload types are generated from your stream(...) calls.
42
43
  // stream({ phase: 'started', progress: 0 });
43
44
  // stream({ phase: 'done', progress: 100, done: true });
@@ -6,7 +6,6 @@
6
6
  //? sane default — adjust the role check or remove the middleware if this
7
7
  //? page is public.
8
8
 
9
- //@ts-ignore We replace {{REL_PATH}} with the relative path to the project root at scaffold time.
10
9
  import type { PageMiddleware } from '@luckystack/core/client';
11
10
  //@ts-ignore We replace {{REL_PATH}} with the relative path to the project root at scaffold time.
12
11
  import type { SessionLayout } from '{{REL_PATH}}config';
@@ -20,12 +19,9 @@ export const middleware: PageMiddleware<SessionLayout> = ({ session }) => {
20
19
  return { success: true };
21
20
  };
22
21
 
23
- interface PageProps {
24
- params: Record<string, string | undefined>;
25
- searchParams: Record<string, string>;
26
- }
27
-
28
- export default function Page({ params, searchParams }: PageProps) {
22
+ //? Route and query values arrive as props when the page needs them:
23
+ //? ({ params, searchParams }: { params: Record<string, string | undefined>; searchParams: Record<string, string> })
24
+ export default function Page() {
29
25
  return (
30
26
  <div className='flex flex-col gap-4 p-6 w-full h-full'>
31
27
  <h1 className='text-2xl font-semibold text-title'>{/* TODO: page title */}</h1>
@@ -5,7 +5,6 @@
5
5
  //? the default surrounding layout (`'plain'`) is what you want. Per-page
6
6
  //? middleware is OPTIONAL — uncomment when this route needs a guard.
7
7
 
8
- //@ts-ignore We replace {{REL_PATH}} with the relative path to the project root at scaffold time.
9
8
  // import type { PageMiddleware } from '@luckystack/core/client';
10
9
  //@ts-ignore We replace {{REL_PATH}} with the relative path to the project root at scaffold time.
11
10
  // import type { SessionLayout } from '{{REL_PATH}}config';
@@ -17,16 +16,12 @@ export const template = 'plain';
17
16
  // return { success: true };
18
17
  // };
19
18
 
20
- interface PageProps {
21
- params: Record<string, string | undefined>;
22
- searchParams: Record<string, string>;
23
- }
24
-
25
- export default function Page({ params, searchParams }: PageProps) {
19
+ //? Route and query values arrive as props when the page needs them:
20
+ //? ({ params, searchParams }: { params: Record<string, string | undefined>; searchParams: Record<string, string> })
21
+ export default function Page() {
26
22
  return (
27
23
  <div className='flex items-center justify-center w-full h-full text-title'>
28
- {/* TODO: replace with your page content */}
29
- <span>page scaffold — replace this</span>
24
+ {/* TODO: replace with your page content; text goes through the project translator */}
30
25
  </div>
31
26
  );
32
27
  }
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  //@ts-ignore We replace {{REL_PATH}} with the relative path to the project root at scaffold time.
5
- import { Functions, SyncClientResponse, SyncClientStreamEmitter } from '{{REL_PATH}}src/_sockets/apiTypes.generated';
5
+ import { Functions, SyncClientResponse, MaybePromise, SyncClientStreamEmitter } from '{{REL_PATH}}src/_sockets/apiTypes.generated';
6
6
 
7
7
 
8
8
  export interface SyncParams {
@@ -20,7 +20,8 @@ export interface SyncParams {
20
20
  stream: SyncClientStreamEmitter;
21
21
  }
22
22
 
23
- export const main = async ({ }: SyncParams): Promise<SyncClientResponse> => {
23
+ // Take what you need from the parameters, e.g. ({ clientInput, serverOutput, token, functions }: SyncParams)
24
+ export const main = (): MaybePromise<SyncClientResponse> => {
24
25
  // THIS FILE RUNS ON THE SERVER AND IT EXECUTES FOR EVERY CLIENT THAT IS IN THE GIVEN ROOM
25
26
  // stream payload types are generated from your stream(...) calls in this file
26
27
  // Use functions.session.getSession(token) when you need session data for this target client.
@@ -17,7 +17,8 @@ export interface SyncParams {
17
17
  stream: SyncClientStreamEmitter;
18
18
  }
19
19
 
20
- export const main = ({ }: SyncParams): MaybePromise<SyncClientResponse> => {
20
+ // Take what you need from the parameters, e.g. ({ clientInput, serverOutput, token, functions }: SyncParams)
21
+ export const main = (): MaybePromise<SyncClientResponse> => {
21
22
  // PAIRED SYNC: Types are shared with the _server_v{number}.ts file
22
23
  // clientInput type comes from _server_v{number}.ts SyncParams
23
24
  // serverOutput type is inferred from _server_v{number}.ts return value
@@ -17,7 +17,8 @@ export interface SyncParams {
17
17
  stream: SyncClientStreamEmitter;
18
18
  }
19
19
 
20
- export const main = ({ }: SyncParams): MaybePromise<SyncClientResponse> => {
20
+ // Take what you need from the parameters, e.g. ({ clientInput, token, functions }: SyncParams)
21
+ export const main = (): MaybePromise<SyncClientResponse> => {
21
22
  // CLIENT-ONLY SYNC: No server processing, runs for each client in the room
22
23
  // stream payload types are generated from your stream(...) calls in this file
23
24
  // Use functions.session.getSession(token) when you need session data for this target client.
@@ -38,7 +38,8 @@ export interface SyncParams {
38
38
  flushPressure: (options?: { thresholdBytes?: number }) => Promise<void>;
39
39
  }
40
40
 
41
- export const main = ({ }: SyncParams): MaybePromise<SyncServerResponse> => {
41
+ // Take what you need from the parameters, e.g. ({ clientInput, user, functions }: SyncParams)
42
+ export const main = (): MaybePromise<SyncServerResponse> => {
42
43
  // THIS FILE RUNS JUST ONCE ON THE SERVER
43
44
 
44
45
  // Stream payload types are generated from your stream(...) calls.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luckystack/devkit",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -56,7 +56,7 @@
56
56
  "test": "vitest run"
57
57
  },
58
58
  "dependencies": {
59
- "@luckystack/core": "^0.12.1",
59
+ "@luckystack/core": "^0.14.0",
60
60
  "chokidar": "^5.0.0",
61
61
  "dotenv": "^17.0.0",
62
62
  "typescript-7-api": "npm:typescript@7.1.0-dev.20261013.1"