@marcoappio/marco-config 4.0.10 → 4.0.12

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.
Files changed (46) hide show
  1. package/dist/appwrite/commands.d.ts +167 -124
  2. package/dist/appwrite/commands.d.ts.map +1 -1
  3. package/dist/appwrite/commands.js +70 -68
  4. package/dist/appwrite/commands.test.js +30 -17
  5. package/dist/appwrite/functions.d.ts +122 -122
  6. package/dist/appwrite/index.d.ts +1 -1
  7. package/dist/appwrite/index.d.ts.map +1 -1
  8. package/dist/appwrite/index.js +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -2
  12. package/dist/index.test.js +14 -0
  13. package/dist/schemas/index.d.ts +0 -12
  14. package/dist/schemas/index.d.ts.map +1 -1
  15. package/dist/schemas/index.js +0 -4
  16. package/dist/schemas/number.d.ts +0 -3
  17. package/dist/schemas/number.d.ts.map +1 -1
  18. package/dist/schemas/number.js +0 -3
  19. package/dist/schemas/string.d.ts +0 -3
  20. package/dist/schemas/string.d.ts.map +1 -1
  21. package/dist/schemas/string.js +0 -3
  22. package/dist/utils/index.d.ts +0 -1
  23. package/dist/utils/index.d.ts.map +1 -1
  24. package/dist/utils/index.js +0 -1
  25. package/package.json +1 -1
  26. package/dist/schemas/boolean.d.ts +0 -5
  27. package/dist/schemas/boolean.d.ts.map +0 -1
  28. package/dist/schemas/boolean.js +0 -4
  29. package/dist/schemas/labels.d.ts +0 -5
  30. package/dist/schemas/labels.d.ts.map +0 -1
  31. package/dist/schemas/labels.js +0 -5
  32. package/dist/schemas/paginatedResponse.d.ts +0 -10
  33. package/dist/schemas/paginatedResponse.d.ts.map +0 -1
  34. package/dist/schemas/paginatedResponse.js +0 -5
  35. package/dist/utils/validation/flattenRequirements/flattenRequirements.d.ts +0 -8
  36. package/dist/utils/validation/flattenRequirements/flattenRequirements.d.ts.map +0 -1
  37. package/dist/utils/validation/flattenRequirements/flattenRequirements.js +0 -37
  38. package/dist/utils/validation/flattenRequirements/flattenRequirements.test.d.ts +0 -2
  39. package/dist/utils/validation/flattenRequirements/flattenRequirements.test.d.ts.map +0 -1
  40. package/dist/utils/validation/flattenRequirements/flattenRequirements.test.js +0 -25
  41. package/dist/utils/validation/flattenRequirements/index.d.ts +0 -2
  42. package/dist/utils/validation/flattenRequirements/index.d.ts.map +0 -1
  43. package/dist/utils/validation/flattenRequirements/index.js +0 -1
  44. package/dist/utils/validation/index.d.ts +0 -2
  45. package/dist/utils/validation/index.d.ts.map +0 -1
  46. package/dist/utils/validation/index.js +0 -1
@@ -11,9 +11,6 @@ export declare const marcoSchemas: {
11
11
  readonly email: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RfcEmailAction<string, undefined>]>, undefined>;
12
12
  }, undefined>;
13
13
  };
14
- boolean: {
15
- fromString: () => import("valibot").SchemaWithPipe<readonly [import("valibot").PicklistSchema<["true", "false"], undefined>, import("valibot").TransformAction<"true" | "false", boolean>, import("valibot").BooleanSchema<undefined>]>;
16
- };
17
14
  emailAccount: {
18
15
  connectionConfigImapRaw: () => import("valibot").ObjectSchema<{
19
16
  readonly imapHost: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
@@ -89,9 +86,6 @@ export declare const marcoSchemas: {
89
86
  required: (maxLength?: number) => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>, import("valibot").BrandAction<string, "ViewId">]>, undefined>;
90
87
  };
91
88
  };
92
- labels: {
93
- specialUse: () => import("valibot").PicklistSchema<readonly ["ARCHIVE", "INBOX", "SENT", "SPAM", "TRASH"], undefined>;
94
- };
95
89
  models: {
96
90
  accountAliasSchema: import("valibot").ObjectSchema<{
97
91
  readonly accountId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>, import("valibot").BrandAction<string, "AccountId">]>, undefined>;
@@ -320,11 +314,8 @@ export declare const marcoSchemas: {
320
314
  }, undefined>;
321
315
  };
322
316
  number: {
323
- fromString: () => import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").FiniteAction<number, undefined>]>;
324
317
  minMax: (min: number, max: number) => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, number, undefined>, import("valibot").MaxValueAction<number, number, undefined>]>, undefined>;
325
- nullable: () => import("valibot").NullableSchema<import("valibot").NumberSchema<undefined>, undefined>;
326
318
  positiveInteger: () => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>, undefined>;
327
- positiveIntegerFromString: () => import("valibot").SchemaWithPipe<readonly [import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").FiniteAction<number, undefined>]>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
328
319
  };
329
320
  oauth: {
330
321
  provider: () => import("valibot").PicklistSchema<readonly ["GOOGLE", "OUTLOOK"], undefined>;
@@ -340,11 +331,8 @@ export declare const marcoSchemas: {
340
331
  };
341
332
  string: {
342
333
  email: () => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RfcEmailAction<string, undefined>]>, undefined>;
343
- enum: (values: Record<string, string>) => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").EnumSchema<Record<string, string>, undefined>]>, undefined>;
344
334
  mailboxAddress: () => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RfcEmailAction<string, undefined>, import("valibot").MaxLengthAction<string, 320, undefined>]>, undefined>;
345
- matches: (regex: RegExp) => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, undefined>;
346
335
  nullable: (maxLength?: number) => import("valibot").NullableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
347
- optional: (maxLength?: number) => import("valibot").UndefinedableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
348
336
  required: (maxLength?: number) => import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
349
337
  };
350
338
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AA2BA,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC3K,YAAY,EACV,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,EACL,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,QAAQ,GACT,MAAM,UAAU,CAAA;AAEjB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAyBA,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC3K,YAAY,EACV,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,EACL,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,QAAQ,GACT,MAAM,UAAU,CAAA;AAEjB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBxB,CAAA"}
@@ -1,9 +1,7 @@
1
1
  import { app } from './app';
2
2
  import { auth } from './auth';
3
- import { boolean } from './boolean';
4
3
  import { emailAccount } from './emailAccount';
5
4
  import { id } from './id';
6
- import { labels } from './labels';
7
5
  import { accountAliasSchema, accountLabelSchema, accountSchema, contactSchema, draftAttachmentSchema, draftBodySchema, draftSchema, threadFullSchema, threadListSchema, threadMessageAttachmentSchema, threadMessageRecipientSchema, threadMessageSchema, threadSchema, userViewSchema, } from './models';
8
6
  import { number } from './number';
9
7
  import { oauth } from './oauth';
@@ -12,10 +10,8 @@ import { string } from './string';
12
10
  export const marcoSchemas = {
13
11
  app,
14
12
  auth,
15
- boolean,
16
13
  emailAccount,
17
14
  id,
18
- labels,
19
15
  models: {
20
16
  accountAliasSchema,
21
17
  accountLabelSchema,
@@ -1,9 +1,6 @@
1
1
  import * as v from 'valibot';
2
2
  export declare const number: {
3
- fromString: () => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
4
3
  minMax: (min: number, max: number) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
5
- nullable: () => v.NullableSchema<v.NumberSchema<undefined>, undefined>;
6
4
  positiveInteger: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
7
- positiveIntegerFromString: () => v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
8
5
  };
9
6
  //# sourceMappingURL=number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/schemas/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,MAAM;;kBASH,MAAM,OAAO,MAAM;;;;CAIlC,CAAA"}
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/schemas/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,MAAM;kBACH,MAAM,OAAO,MAAM;;CAElC,CAAA"}
@@ -1,8 +1,5 @@
1
1
  import * as v from 'valibot';
2
2
  export const number = {
3
- fromString: () => v.pipe(v.string(), v.nonEmpty(), v.transform(value => Number(value)), v.number(), v.finite()),
4
3
  minMax: (min, max) => v.nonOptional(v.pipe(v.number(), v.minValue(min), v.maxValue(max))),
5
- nullable: () => v.nullable(v.number()),
6
4
  positiveInteger: () => v.nonOptional(v.pipe(v.number(), v.integer(), v.minValue(0))),
7
- positiveIntegerFromString: () => v.pipe(number.fromString(), v.integer(), v.minValue(0)),
8
5
  };
@@ -1,11 +1,8 @@
1
1
  import * as v from 'valibot';
2
2
  export declare const string: {
3
3
  email: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, undefined>;
4
- enum: (values: Record<string, string>) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EnumSchema<Record<string, string>, undefined>]>, undefined>;
5
4
  mailboxAddress: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
6
- matches: (regex: RegExp) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
7
5
  nullable: (maxLength?: number) => v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
8
- optional: (maxLength?: number) => v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
9
6
  required: (maxLength?: number) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
10
7
  };
11
8
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/schemas/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,MAAM;;mBAEF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;qBAEpB,MAAM;;;;CAIxB,CAAA"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/schemas/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,MAAM;;;;;CAKlB,CAAA"}
@@ -1,10 +1,7 @@
1
1
  import * as v from 'valibot';
2
2
  export const string = {
3
3
  email: () => v.nonOptional(v.pipe(v.string(), v.rfcEmail())),
4
- enum: (values) => v.nonOptional(v.pipe(v.string(), v.enum(values))),
5
4
  mailboxAddress: () => v.nonOptional(v.pipe(v.string(), v.rfcEmail(), v.maxLength(320))),
6
- matches: (regex) => v.nonOptional(v.pipe(v.string(), v.regex(regex))),
7
5
  nullable: (maxLength = 255) => v.nullable(v.pipe(v.string(), v.nonEmpty(), v.maxLength(maxLength))),
8
- optional: (maxLength = 255) => v.undefinedable(v.pipe(v.string(), v.nonEmpty(), v.maxLength(maxLength))),
9
6
  required: (maxLength = 255) => v.nonOptional(v.pipe(v.string(), v.nonEmpty(), v.maxLength(maxLength))),
10
7
  };
@@ -1,5 +1,4 @@
1
1
  export { accountUtils } from './accounts';
2
2
  export { labelUtils } from './labels';
3
3
  export { threadsUtils } from './threads';
4
- export { flattenRequirements, type SchemaRequirements } from './validation';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
@@ -1,4 +1,3 @@
1
1
  export { accountUtils } from './accounts';
2
2
  export { labelUtils } from './labels';
3
3
  export { threadsUtils } from './threads';
4
- export { flattenRequirements } from './validation';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",
@@ -1,5 +0,0 @@
1
- import * as v from 'valibot';
2
- export declare const boolean: {
3
- fromString: () => v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false"], undefined>, v.TransformAction<"true" | "false", boolean>, v.BooleanSchema<undefined>]>;
4
- };
5
- //# sourceMappingURL=boolean.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/schemas/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,OAAO;;CAOnB,CAAA"}
@@ -1,4 +0,0 @@
1
- import * as v from 'valibot';
2
- export const boolean = {
3
- fromString: () => v.pipe(v.picklist(['true', 'false']), v.transform(value => value === 'true'), v.boolean()),
4
- };
@@ -1,5 +0,0 @@
1
- import * as v from 'valibot';
2
- export declare const labels: {
3
- specialUse: () => v.PicklistSchema<readonly ["ARCHIVE", "INBOX", "SENT", "SPAM", "TRASH"], undefined>;
4
- };
5
- //# sourceMappingURL=labels.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/schemas/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,eAAO,MAAM,MAAM;;CAElB,CAAA"}
@@ -1,5 +0,0 @@
1
- import * as v from 'valibot';
2
- import { LABEL_SPECIAL_USES } from '../types';
3
- export const labels = {
4
- specialUse: () => v.picklist(LABEL_SPECIAL_USES),
5
- };
@@ -1,10 +0,0 @@
1
- import * as v from 'valibot';
2
- export declare const paginatedResponseSchema: <T extends v.GenericSchema>(itemSchema: T) => v.ObjectSchema<{
3
- readonly items: v.ArraySchema<T, undefined>;
4
- readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5
- }, undefined>;
6
- export type PaginatedResponse<T> = {
7
- items: T[];
8
- nextCursor: string | null;
9
- };
10
- //# sourceMappingURL=paginatedResponse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paginatedResponse.d.ts","sourceRoot":"","sources":["../../src/schemas/paginatedResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,CAAC,CAAC,aAAa,cAAc,CAAC;;;aAI5E,CAAA;AAEJ,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA"}
@@ -1,5 +0,0 @@
1
- import * as v from 'valibot';
2
- export const paginatedResponseSchema = (itemSchema) => v.object({
3
- items: v.array(itemSchema),
4
- nextCursor: v.nullable(v.string()),
5
- });
@@ -1,8 +0,0 @@
1
- import type { ReadonlyDeep } from 'type-fest';
2
- import * as v from 'valibot';
3
- export type SchemaRequirements = ReadonlyDeep<{
4
- maxLength?: number;
5
- minLength?: number;
6
- }>;
7
- export declare const flattenRequirements: <TEntries extends v.ObjectEntries>(schema: Pick<v.ObjectSchema<TEntries, v.ErrorMessage<v.ObjectIssue> | undefined>, "entries">) => ReadonlyDeep<Record<string, SchemaRequirements>>;
8
- //# sourceMappingURL=flattenRequirements.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flattenRequirements.d.ts","sourceRoot":"","sources":["../../../../src/utils/validation/flattenRequirements/flattenRequirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAsDF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,CAAC,CAAC,aAAa,UAC1D,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,EAAE,SAAS,CAAC,KAC3F,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAA4G,CAAA"}
@@ -1,37 +0,0 @@
1
- import * as v from 'valibot';
2
- const pipeSchema = v.array(v.unknown());
3
- const directFieldSchema = v.looseObject({ pipe: pipeSchema });
4
- const wrappedFieldSchema = v.looseObject({ wrapped: v.looseObject({ pipe: pipeSchema }) });
5
- const requirementSchema = v.looseObject({
6
- requirement: v.number(),
7
- type: v.picklist(['max_length', 'min_length']),
8
- });
9
- const getPipe = (field) => {
10
- const directResult = v.safeParse(directFieldSchema, field);
11
- if (directResult.success) {
12
- return directResult.output.pipe;
13
- }
14
- const wrappedResult = v.safeParse(wrappedFieldSchema, field);
15
- if (wrappedResult.success) {
16
- return wrappedResult.output.wrapped.pipe;
17
- }
18
- return [];
19
- };
20
- const getRequirements = (field) => Object.fromEntries(getPipe(field)
21
- .reduce(([maxLength, minLength], item) => {
22
- const result = v.safeParse(requirementSchema, item);
23
- if (result.success && result.output.type === 'max_length') {
24
- return [Math.min(maxLength ?? result.output.requirement, result.output.requirement), minLength];
25
- }
26
- if (result.success) {
27
- return [maxLength, Math.max(minLength ?? result.output.requirement, result.output.requirement)];
28
- }
29
- return [maxLength, minLength];
30
- }, [null, null])
31
- .flatMap((requirement, index) => {
32
- if (requirement !== null) {
33
- return [[index === 0 ? 'maxLength' : 'minLength', requirement]];
34
- }
35
- return [];
36
- }));
37
- export const flattenRequirements = (schema) => Object.fromEntries(Object.entries(schema.entries).map(([key, field]) => [key, getRequirements(field)]));
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=flattenRequirements.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flattenRequirements.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/validation/flattenRequirements/flattenRequirements.test.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import * as v from 'valibot';
3
- import { flattenRequirements } from './flattenRequirements';
4
- describe('flattenRequirements', () => {
5
- it('retains direct, wrapped, and unconstrained field requirements', () => {
6
- const schema = v.object({
7
- direct: v.pipe(v.string(), v.minLength(2), v.maxLength(64)),
8
- plain: v.string(),
9
- wrapped: v.optional(v.pipe(v.string(), v.minLength(3), v.maxLength(128))),
10
- });
11
- expect(flattenRequirements(schema)).toEqual({
12
- direct: { maxLength: 64, minLength: 2 },
13
- plain: {},
14
- wrapped: { maxLength: 128, minLength: 3 },
15
- });
16
- });
17
- it('retains the strictest repeated length requirements', () => {
18
- const schema = v.object({
19
- value: v.pipe(v.string(), v.minLength(8), v.minLength(2), v.maxLength(32), v.maxLength(128)),
20
- });
21
- expect(flattenRequirements(schema)).toEqual({
22
- value: { maxLength: 32, minLength: 8 },
23
- });
24
- });
25
- });
@@ -1,2 +0,0 @@
1
- export { flattenRequirements, type SchemaRequirements } from './flattenRequirements';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/validation/flattenRequirements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -1 +0,0 @@
1
- export { flattenRequirements } from './flattenRequirements';
@@ -1,2 +0,0 @@
1
- export { flattenRequirements, type SchemaRequirements } from './flattenRequirements';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -1 +0,0 @@
1
- export { flattenRequirements } from './flattenRequirements';