@trypattern/sdk 0.1.30 → 0.1.32
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/bookings.d.ts +8 -8
- package/dist/bookingsStore.d.ts +24 -24
- package/dist/components/Dialog.d.ts +1 -1
- package/dist/components/Dialog.js +138 -4
- package/dist/components/FilePicker.d.ts +13 -0
- package/dist/components/FilePicker.js +81 -0
- package/dist/components/Gallery.d.ts +17 -0
- package/dist/components/Gallery.js +198 -0
- package/dist/components/Header.d.ts +6 -0
- package/dist/components/Header.js +42 -0
- package/dist/components/ProgressBar.d.ts +8 -0
- package/dist/components/ProgressBar.js +29 -0
- package/dist/components/TableRow.d.ts +9 -0
- package/dist/components/TableRow.js +36 -0
- package/dist/components/icons.d.ts +2 -0
- package/dist/components/icons.js +6 -0
- package/dist/components/interaction.d.ts +1 -1
- package/dist/files.d.ts +11 -0
- package/dist/files.js +19 -0
- package/dist/flows/flows.d.ts +7 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/publishWire.d.ts +63 -27
- package/dist/publishWire.js +14 -0
- package/dist/react.d.ts +5 -0
- package/dist/react.js +5 -0
- package/dist/rules/lintPlugin.js +8 -1
- package/dist/schema.d.ts +1 -1
- package/dist/server/services.d.ts +2 -2
- package/dist/server/services.js +21 -4
- package/dist/serviceClients.js +107 -23
- package/dist/services.d.ts +28 -4
- package/dist/services.js +8 -4
- package/dist/theme/tokens.stylex.d.ts +4 -0
- package/dist/theme/tokens.stylex.js +2 -0
- package/package.json +1 -1
package/dist/services.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { PickedFile } from './files.ts';
|
|
2
3
|
import type { SameOnTheWire } from './wire.ts';
|
|
3
4
|
type Shape = z.ZodRawShape;
|
|
4
5
|
type NoShape = Record<never, never>;
|
|
@@ -6,11 +7,16 @@ type ParamNames<Path extends string> = Path extends `${string}:${infer Param}/${
|
|
|
6
7
|
export type ParamsOf<Path extends string> = {
|
|
7
8
|
readonly [Name in ParamNames<Path>]: string;
|
|
8
9
|
};
|
|
9
|
-
export type ServiceCall<Path extends string = string, S extends Shape = Shape, Reply extends z.ZodType = z.ZodType> = {
|
|
10
|
+
export type ServiceCall<Path extends string = string, S extends Shape = Shape, Reply extends z.ZodType = z.ZodType, Upload extends boolean = boolean> = {
|
|
10
11
|
readonly method: 'get' | 'post';
|
|
11
12
|
readonly path: Path;
|
|
12
13
|
readonly input: z.ZodObject<S>;
|
|
13
14
|
readonly reply: Reply;
|
|
15
|
+
readonly isUpload: Upload;
|
|
16
|
+
};
|
|
17
|
+
export type UploadOptions = {
|
|
18
|
+
readonly onProgress?: (sent: number, total: number) => void;
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
14
20
|
};
|
|
15
21
|
type StaticTypeError<Message extends string> = Message;
|
|
16
22
|
type NotText = StaticTypeError<'A get call sends its input in the address, where everything is text: use z.string() or z.enum() here, or make it a post call'>;
|
|
@@ -26,12 +32,30 @@ type CallOptions<Path extends string, S extends Shape, Reply extends z.ZodType>
|
|
|
26
32
|
input?: SameOnTheWire<S>;
|
|
27
33
|
reply: Reply;
|
|
28
34
|
};
|
|
29
|
-
|
|
35
|
+
type UploadCallOptions<Path extends string, S extends Shape, Reply extends z.ZodType> = {
|
|
36
|
+
upload: Path;
|
|
37
|
+
input?: TextOnly<S> & SameOnTheWire<S>;
|
|
38
|
+
reply: Reply;
|
|
39
|
+
};
|
|
40
|
+
export declare function call<Path extends string, Reply extends z.ZodType, S extends Shape = NoShape>(options: UploadCallOptions<Path, S, Reply>): NoInfer<ServiceCall<Path, S, Reply, true>>;
|
|
41
|
+
export declare function call<Path extends string, Reply extends z.ZodType, S extends Shape = NoShape>(options: CallOptions<Path, S, Reply>): NoInfer<ServiceCall<Path, S, Reply, false>>;
|
|
30
42
|
export type Services = Readonly<Record<string, Readonly<Record<string, ServiceCall>>>>;
|
|
31
43
|
export declare function defineServices<const Group extends Services>(services: Group): Group;
|
|
32
|
-
|
|
44
|
+
type FieldsOf<Call> = Call extends ServiceCall<infer Path, infer S, z.ZodType> ? ParamsOf<Path> & (keyof S extends never ? NoShape : z.output<z.ZodObject<S>>) : never;
|
|
45
|
+
export type CallInput<Call> = FieldsOf<Call> & (Call extends {
|
|
46
|
+
readonly isUpload: true;
|
|
47
|
+
} ? {
|
|
48
|
+
file: PickedFile;
|
|
49
|
+
} : NoShape);
|
|
50
|
+
export type HandlerInput<Call> = FieldsOf<Call> & (Call extends {
|
|
51
|
+
readonly isUpload: true;
|
|
52
|
+
} ? {
|
|
53
|
+
file: File;
|
|
54
|
+
} : NoShape);
|
|
33
55
|
export type CallReply<Call> = Call extends ServiceCall<string, Shape, infer Reply> ? z.output<Reply> : never;
|
|
34
|
-
type ClientCall<Call> =
|
|
56
|
+
type ClientCall<Call> = Call extends {
|
|
57
|
+
readonly isUpload: true;
|
|
58
|
+
} ? (input: CallInput<Call>, options?: UploadOptions) => Promise<CallReply<Call>> : keyof CallInput<Call> extends never ? (input?: CallInput<Call>) => Promise<CallReply<Call>> : (input: CallInput<Call>) => Promise<CallReply<Call>>;
|
|
35
59
|
export type ServiceClient<Group extends Services> = {
|
|
36
60
|
readonly [Name in keyof Group]: {
|
|
37
61
|
readonly [Call in keyof Group[Name]]: ClientCall<Group[Name][Call]>;
|
package/dist/services.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function call(options) {
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const path = 'get' in options
|
|
4
|
+
? options.get
|
|
5
|
+
: 'post' in options
|
|
6
|
+
? options.post
|
|
7
|
+
: options.upload;
|
|
5
8
|
return {
|
|
6
|
-
method,
|
|
9
|
+
method: 'get' in options ? 'get' : 'post',
|
|
7
10
|
path,
|
|
8
11
|
input: z.object((options.input ?? {})),
|
|
9
|
-
reply: options.reply
|
|
12
|
+
reply: options.reply,
|
|
13
|
+
isUpload: 'upload' in options
|
|
10
14
|
};
|
|
11
15
|
}
|
|
12
16
|
export function defineServices(services) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
export declare const galleryMarker: Readonly<{
|
|
3
|
+
readonly marker: stylex.StyleXClassNameFor<"marker", symbol>;
|
|
4
|
+
}>;
|
|
2
5
|
export declare const breakpoints: {
|
|
3
6
|
compact: string;
|
|
4
7
|
canHover: string;
|
|
@@ -148,6 +151,7 @@ export declare const widths: stylex.VarGroup<Readonly<{
|
|
|
148
151
|
toast: string;
|
|
149
152
|
}>, symbol>;
|
|
150
153
|
export declare const layers: {
|
|
154
|
+
header: string;
|
|
151
155
|
scrim: string;
|
|
152
156
|
sidebar: string;
|
|
153
157
|
menu: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
export const galleryMarker = stylex.defineMarker();
|
|
2
3
|
export const breakpoints = stylex.defineConsts({
|
|
3
4
|
compact: '@media (max-width: 767px)',
|
|
4
5
|
canHover: '@media (hover: hover)',
|
|
@@ -148,6 +149,7 @@ export const widths = stylex.defineVars({
|
|
|
148
149
|
toast: '356px'
|
|
149
150
|
});
|
|
150
151
|
export const layers = stylex.defineConsts({
|
|
152
|
+
header: '10',
|
|
151
153
|
scrim: '15',
|
|
152
154
|
sidebar: '20',
|
|
153
155
|
menu: '20',
|