@marcoappio/marco-config 4.0.11 → 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.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.test.js +14 -0
- package/dist/schemas/index.d.ts +0 -12
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +0 -4
- package/dist/schemas/number.d.ts +0 -3
- package/dist/schemas/number.d.ts.map +1 -1
- package/dist/schemas/number.js +0 -3
- package/dist/schemas/string.d.ts +0 -3
- package/dist/schemas/string.d.ts.map +1 -1
- package/dist/schemas/string.js +0 -3
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/package.json +1 -1
- package/dist/schemas/boolean.d.ts +0 -5
- package/dist/schemas/boolean.d.ts.map +0 -1
- package/dist/schemas/boolean.js +0 -4
- package/dist/schemas/labels.d.ts +0 -5
- package/dist/schemas/labels.d.ts.map +0 -1
- package/dist/schemas/labels.js +0 -5
- package/dist/schemas/paginatedResponse.d.ts +0 -10
- package/dist/schemas/paginatedResponse.d.ts.map +0 -1
- package/dist/schemas/paginatedResponse.js +0 -5
- package/dist/utils/validation/flattenRequirements/flattenRequirements.d.ts +0 -8
- package/dist/utils/validation/flattenRequirements/flattenRequirements.d.ts.map +0 -1
- package/dist/utils/validation/flattenRequirements/flattenRequirements.js +0 -37
- package/dist/utils/validation/flattenRequirements/flattenRequirements.test.d.ts +0 -2
- package/dist/utils/validation/flattenRequirements/flattenRequirements.test.d.ts.map +0 -1
- package/dist/utils/validation/flattenRequirements/flattenRequirements.test.js +0 -25
- package/dist/utils/validation/flattenRequirements/index.d.ts +0 -2
- package/dist/utils/validation/flattenRequirements/index.d.ts.map +0 -1
- package/dist/utils/validation/flattenRequirements/index.js +0 -1
- package/dist/utils/validation/index.d.ts +0 -2
- package/dist/utils/validation/index.d.ts.map +0 -1
- package/dist/utils/validation/index.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { type AppwriteCommandError, type AppwriteCommandKind, type AppwriteComma
|
|
|
2
2
|
export { marcoConstants } from './constants';
|
|
3
3
|
export { type Account, type AccountAlias, type AccountId, type AccountLabel, type AliasId, type AttachmentId, type Contact, type ContactId, type Draft, type DraftAttachment, type DraftBody, type DraftId, type JobId, type LabelId, type MessageId, marcoSchemas, type PushNotificationTokenId, type RecipientId, type Thread, type ThreadId, type ThreadMessage, type ThreadMessageAttachment, type ThreadMessageRecipient, type UserId, type UserView, type ViewId, } from './schemas';
|
|
4
4
|
export * from './types';
|
|
5
|
-
export { accountUtils,
|
|
5
|
+
export { accountUtils, labelUtils, threadsUtils } from './utils';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK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AA;AAC5C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,GACZ,MAAM,WAAW,CAAA;AAClB,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,4 @@ export { accountProviders, accountStates, appwrite, appwriteAvatar, appwriteComm
|
|
|
2
2
|
export { marcoConstants } from './constants';
|
|
3
3
|
export { marcoSchemas, } from './schemas';
|
|
4
4
|
export * from './types';
|
|
5
|
-
export { accountUtils,
|
|
5
|
+
export { accountUtils, labelUtils, threadsUtils } from './utils';
|
package/dist/index.test.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
const removedSchemaRequirements = undefined;
|
|
2
3
|
describe('public exports', () => {
|
|
3
4
|
it('loads the public entry point', async () => {
|
|
4
5
|
await expect(import('./index')).resolves.toBeDefined();
|
|
@@ -19,6 +20,19 @@ describe('public exports', () => {
|
|
|
19
20
|
expect('stripeUserDataSchema' in config.marcoSchemas.models).toBe(false);
|
|
20
21
|
expect('userSchema' in config.marcoSchemas.models).toBe(false);
|
|
21
22
|
});
|
|
23
|
+
it('omits unused schema and validation helpers', async () => {
|
|
24
|
+
const config = await import('./index');
|
|
25
|
+
expect(removedSchemaRequirements).toBeUndefined();
|
|
26
|
+
expect('flattenRequirements' in config).toBe(false);
|
|
27
|
+
expect('boolean' in config.marcoSchemas).toBe(false);
|
|
28
|
+
expect('labels' in config.marcoSchemas).toBe(false);
|
|
29
|
+
expect('fromString' in config.marcoSchemas.number).toBe(false);
|
|
30
|
+
expect('nullable' in config.marcoSchemas.number).toBe(false);
|
|
31
|
+
expect('positiveIntegerFromString' in config.marcoSchemas.number).toBe(false);
|
|
32
|
+
expect('enum' in config.marcoSchemas.string).toBe(false);
|
|
33
|
+
expect('matches' in config.marcoSchemas.string).toBe(false);
|
|
34
|
+
expect('optional' in config.marcoSchemas.string).toBe(false);
|
|
35
|
+
});
|
|
22
36
|
it('omits the Railway REST constants', async () => {
|
|
23
37
|
const config = await import('./index');
|
|
24
38
|
expect('api' in config.marcoConstants).toBe(false);
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -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":"
|
|
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"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -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,
|
package/dist/schemas/number.d.ts
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/schemas/number.js
CHANGED
|
@@ -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
|
};
|
package/dist/schemas/string.d.ts
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/schemas/string.js
CHANGED
|
@@ -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
|
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -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"}
|
package/dist/schemas/boolean.js
DELETED
package/dist/schemas/labels.d.ts
DELETED
|
@@ -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"}
|
package/dist/schemas/labels.js
DELETED
|
@@ -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,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 +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 +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 +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';
|