@krak-stack/registry 0.1.39 → 0.1.40

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.
@@ -29,8 +29,8 @@ export declare const SortParams: Schema.declare<readonly {
29
29
  readonly direction: "asc" | "desc";
30
30
  }[]>;
31
31
  export declare const Query: Schema.Struct<{
32
- readonly page: Schema.decodeTo<Schema.Int, Schema.optionalKey<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
33
- readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optionalKey<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
32
+ readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
33
+ readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
34
34
  readonly globalFilter: Schema.optional<Schema.String>;
35
35
  readonly sort: Schema.optional<Schema.declare<readonly {
36
36
  readonly id: string;
@@ -42,7 +42,34 @@ export declare const Query: Schema.Struct<{
42
42
  }>;
43
43
  export type QueryType = typeof Query.Type;
44
44
  export type QueryEncoded = typeof Query.Encoded;
45
- export declare const QueryStandard: ReturnType<typeof Schema.toStandardSchemaV1<typeof Query>>;
45
+ export declare const QueryStandard: import("effect/StandardSchema").StandardSchemaV1<{
46
+ readonly globalFilter?: string | undefined;
47
+ readonly sort?: readonly {
48
+ readonly id: string;
49
+ readonly direction: "asc" | "desc";
50
+ }[] | undefined;
51
+ readonly page?: string | number | undefined;
52
+ readonly pageSize?: string | number | undefined;
53
+ }, {
54
+ readonly globalFilter?: string | undefined;
55
+ readonly sort?: readonly {
56
+ readonly id: string;
57
+ readonly direction: "asc" | "desc";
58
+ }[] | undefined;
59
+ readonly page?: number | undefined;
60
+ readonly pageSize?: number | undefined;
61
+ }> & Schema.Struct<{
62
+ readonly globalFilter: Schema.optional<Schema.String>;
63
+ readonly sort: Schema.optional<Schema.declare<readonly {
64
+ readonly id: string;
65
+ readonly direction: "asc" | "desc";
66
+ }[], readonly {
67
+ readonly id: string;
68
+ readonly direction: "asc" | "desc";
69
+ }[]>>;
70
+ readonly page: Schema.decodeTo<Schema.optional<Schema.Int>, Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>, never, never>;
71
+ readonly pageSize: Schema.decodeTo<Schema.optional<Schema.Int>, Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>, never, never>;
72
+ }>;
46
73
  export declare const PaginationMeta: Schema.Struct<{
47
74
  readonly page: Schema.Int;
48
75
  readonly pageSize: Schema.Int;
package/dist/lib/query.js CHANGED
@@ -81,11 +81,11 @@ var SortParams = Schema.declare(Schema.is(SortParamsArray), {
81
81
  toCodecStringTree: () => Schema.link()(SortParamsFromString, SchemaTransformation.passthrough())
82
82
  });
83
83
  var Query = Schema.Struct({
84
- page: Schema.optionalKey(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
84
+ page: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
85
85
  decode: SchemaGetter.withDefault(Effect.succeed(0)),
86
86
  encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
87
87
  })),
88
- pageSize: Schema.optionalKey(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
88
+ pageSize: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
89
89
  decode: SchemaGetter.withDefault(Effect.succeed(20)),
90
90
  encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
91
91
  })),
@@ -107,7 +107,17 @@ var Query = Schema.Struct({
107
107
  }
108
108
  ]
109
109
  });
110
- var QueryStandard = Schema.toStandardSchemaV1(Query);
110
+ var QueryStandard = Schema.toStandardSchemaV1(Schema.Struct({
111
+ ...Query.fields,
112
+ page: Query.fields.page.pipe(Schema.decodeTo(Schema.optional(Schema.Int), {
113
+ decode: SchemaGetter.transform((page) => page === 0 ? undefined : page),
114
+ encode: SchemaGetter.transform((page) => page ?? 0)
115
+ })),
116
+ pageSize: Query.fields.pageSize.pipe(Schema.decodeTo(Schema.optional(Schema.Int), {
117
+ decode: SchemaGetter.transform((pageSize) => pageSize === 20 ? undefined : pageSize),
118
+ encode: SchemaGetter.transform((pageSize) => pageSize ?? 20)
119
+ }))
120
+ }).annotate({ identifier: "QuerySearch" }));
111
121
  var PaginationMeta = Schema.Struct({
112
122
  page: Schema.Int,
113
123
  pageSize: Schema.Int,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {