@palmares/schemas 0.1.21 → 0.1.23
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/CHANGELOG.md +17 -0
- package/package.json +10 -4
- package/.turbo/turbo-build$colon$watch.log +0 -24
- package/.turbo/turbo-build.log +0 -13
- package/.turbo/turbo-build:watch.log +0 -26
- package/__tests__/.drizzle/migrations/0000_skinny_harrier.sql +0 -22
- package/__tests__/.drizzle/migrations/meta/0000_snapshot.json +0 -156
- package/__tests__/.drizzle/migrations/meta/_journal.json +0 -13
- package/__tests__/.drizzle/schema.ts +0 -35
- package/__tests__/drizzle.config.ts +0 -11
- package/__tests__/eslint.config.js +0 -10
- package/__tests__/manage.ts +0 -5
- package/__tests__/node_modules/.bin/drizzle-kit +0 -17
- package/__tests__/node_modules/.bin/node-gyp +0 -17
- package/__tests__/node_modules/.bin/tsc +0 -17
- package/__tests__/node_modules/.bin/tsserver +0 -17
- package/__tests__/node_modules/.bin/tsx +0 -17
- package/__tests__/package.json +0 -34
- package/__tests__/sqlite.db +0 -0
- package/__tests__/src/core/array.test.ts +0 -131
- package/__tests__/src/core/boolean.test.ts +0 -66
- package/__tests__/src/core/datetime.test.ts +0 -102
- package/__tests__/src/core/index.ts +0 -35
- package/__tests__/src/core/model.test.ts +0 -260
- package/__tests__/src/core/models.ts +0 -50
- package/__tests__/src/core/numbers.test.ts +0 -177
- package/__tests__/src/core/object.test.ts +0 -218
- package/__tests__/src/core/string.test.ts +0 -222
- package/__tests__/src/core/test.test.ts +0 -59
- package/__tests__/src/core/types.test.ts +0 -97
- package/__tests__/src/core/union.test.ts +0 -99
- package/__tests__/src/settings.ts +0 -69
- package/__tests__/tsconfig.json +0 -11
- package/src/adapter/fields/array.ts +0 -31
- package/src/adapter/fields/boolean.ts +0 -43
- package/src/adapter/fields/datetime.ts +0 -43
- package/src/adapter/fields/index.ts +0 -72
- package/src/adapter/fields/number.ts +0 -43
- package/src/adapter/fields/object.ts +0 -52
- package/src/adapter/fields/string.ts +0 -43
- package/src/adapter/fields/union.ts +0 -43
- package/src/adapter/index.ts +0 -37
- package/src/adapter/types.ts +0 -276
- package/src/compile.ts +0 -14
- package/src/conf.ts +0 -30
- package/src/constants.ts +0 -7
- package/src/domain.ts +0 -15
- package/src/exceptions.ts +0 -17
- package/src/index.ts +0 -318
- package/src/middleware.ts +0 -52
- package/src/model.ts +0 -518
- package/src/parsers/convert-from-number.ts +0 -13
- package/src/parsers/convert-from-string.ts +0 -19
- package/src/parsers/index.ts +0 -2
- package/src/schema/array.ts +0 -825
- package/src/schema/boolean.ts +0 -792
- package/src/schema/datetime.ts +0 -704
- package/src/schema/index.ts +0 -5
- package/src/schema/number.ts +0 -929
- package/src/schema/object.ts +0 -799
- package/src/schema/schema.ts +0 -1179
- package/src/schema/string.ts +0 -941
- package/src/schema/types.ts +0 -154
- package/src/schema/union.ts +0 -724
- package/src/types.ts +0 -66
- package/src/utils.ts +0 -389
- package/src/validators/array.ts +0 -183
- package/src/validators/boolean.ts +0 -52
- package/src/validators/datetime.ts +0 -121
- package/src/validators/number.ts +0 -178
- package/src/validators/object.ts +0 -56
- package/src/validators/schema.ts +0 -142
- package/src/validators/string.ts +0 -278
- package/src/validators/types.ts +0 -1
- package/src/validators/union.ts +0 -52
- package/src/validators/utils.ts +0 -226
- package/tsconfig.json +0 -9
- package/tsconfig.types.json +0 -10
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# @palmares/schemas
|
2
2
|
|
3
|
+
## 0.1.23
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies
|
8
|
+
- @palmares/databases@0.1.19
|
9
|
+
- @palmares/server@0.1.16
|
10
|
+
|
11
|
+
## 0.1.22
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- 80b60c3: Go back to dependencies from peerDependencies, should work fine now
|
16
|
+
- Updated dependencies [80b60c3]
|
17
|
+
- @palmares/databases@0.1.18
|
18
|
+
- @palmares/server@0.1.15
|
19
|
+
|
3
20
|
## 0.1.21
|
4
21
|
|
5
22
|
### Patch Changes
|
package/package.json
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "@palmares/schemas",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.23",
|
4
4
|
"description": "This defines a default schema definition for validation of data, it abstract popular schema validation libraries like zod, yup, valibot and others\"",
|
5
5
|
"main": "./dist/cjs/src/index.js",
|
6
6
|
"module": "./dist/esm/src/index.js",
|
7
7
|
"types": "./dist/cjs/types/index.d.ts",
|
8
|
+
"files": [
|
9
|
+
"dist",
|
10
|
+
"package.json",
|
11
|
+
"README.md",
|
12
|
+
"CHANGELOG.md"
|
13
|
+
],
|
8
14
|
"exports": {
|
9
15
|
".": {
|
10
16
|
"import": {
|
@@ -34,10 +40,10 @@
|
|
34
40
|
"url": "https://github.com/palmaresHQ/palmares/issues"
|
35
41
|
},
|
36
42
|
"homepage": "https://github.com/palmaresHQ/palmares#readme",
|
37
|
-
"
|
43
|
+
"dependencies": {
|
38
44
|
"@palmares/core": "0.1.14",
|
39
|
-
"@palmares/databases": "0.1.
|
40
|
-
"@palmares/server": "0.1.
|
45
|
+
"@palmares/databases": "0.1.19",
|
46
|
+
"@palmares/server": "0.1.16"
|
41
47
|
},
|
42
48
|
"scripts": {
|
43
49
|
"clear": "rimraf ./dist",
|
@@ -1,24 +0,0 @@
|
|
1
|
-
|
2
|
-
> @palmares/schemas@0.1.3 build:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
3
|
-
> pnpm run build:cjs:watch & pnpm run build:module:watch & pnpm run build:types:watch
|
4
|
-
|
5
|
-
|
6
|
-
> @palmares/schemas@0.1.3 build:module:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
7
|
-
> swc ./src -d ./dist/esm --config-file ../../build/.esm.swcrc --watch
|
8
|
-
|
9
|
-
|
10
|
-
> @palmares/schemas@0.1.3 build:cjs:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
11
|
-
> swc ./src -d ./dist/cjs --config-file ../../build/.commonjs.swcrc --watch
|
12
|
-
|
13
|
-
|
14
|
-
> @palmares/schemas@0.1.3 build:types:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
15
|
-
> tsc --project tsconfig.types.json --watch --preserveWatchOutput
|
16
|
-
|
17
|
-
[[90m9:38:16 AM[0m] Starting compilation in watch mode...
|
18
|
-
|
19
|
-
Successfully compiled: 42 files with swc (462.53ms)
|
20
|
-
Successfully compiled: 42 files with swc (463.62ms)
|
21
|
-
Watching for file changes.
|
22
|
-
Watching for file changes.
|
23
|
-
[[90m9:38:17 AM[0m] Found 0 errors. Watching for file changes.
|
24
|
-
|
package/.turbo/turbo-build.log
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
> @palmares/schemas@0.1.20 build /Users/nicolasmelo/workspace/palmares/packages/schemas
|
3
|
-
> pnpm run clear && pnpm run build:cjs && pnpm run build:module && pnpm run build:types
|
4
|
-
|
5
|
-
|
6
|
-
> @palmares/schemas@0.1.20 clear /Users/nicolasmelo/workspace/palmares/packages/schemas
|
7
|
-
> rimraf ./dist
|
8
|
-
|
9
|
-
|
10
|
-
> @palmares/schemas@0.1.20 build:cjs /Users/nicolasmelo/workspace/palmares/packages/schemas
|
11
|
-
> swc ./src -d ./dist/cjs --config-file ../../build/.commonjs.swcrc
|
12
|
-
|
13
|
-
Successfully compiled: 43 files with swc (177.88ms)
|
@@ -1,26 +0,0 @@
|
|
1
|
-
[32m@palmares/schemas:build:watch[0m: cache hit, replaying output [2m2e7590ff876977be[0m
|
2
|
-
[32m@palmares/schemas:build:watch: [0m
|
3
|
-
[32m@palmares/schemas:build:watch: [0m> @palmares/schemas@0.0.0 build:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
4
|
-
[32m@palmares/schemas:build:watch: [0m> pnpm run build:cjs:watch & pnpm run build:module:watch & pnpm run build:types:watch
|
5
|
-
[32m@palmares/schemas:build:watch: [0m
|
6
|
-
[32m@palmares/schemas:build:watch: [0m
|
7
|
-
[32m@palmares/schemas:build:watch: [0m> @palmares/schemas@0.0.0 build:module:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
8
|
-
[32m@palmares/schemas:build:watch: [0m> swc ./src -d ./dist/esm --config-file ../../build/.esm.swcrc --watch
|
9
|
-
[32m@palmares/schemas:build:watch: [0m
|
10
|
-
[32m@palmares/schemas:build:watch: [0m
|
11
|
-
[32m@palmares/schemas:build:watch: [0m> @palmares/schemas@0.0.0 build:cjs:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
12
|
-
[32m@palmares/schemas:build:watch: [0m> swc ./src -d ./dist/cjs --config-file ../../build/.commonjs.swcrc --watch
|
13
|
-
[32m@palmares/schemas:build:watch: [0m
|
14
|
-
[32m@palmares/schemas:build:watch: [0m
|
15
|
-
[32m@palmares/schemas:build:watch: [0m> @palmares/schemas@0.0.0 build:types:watch /Users/nicolasmelo/workspace/palmares/packages/schemas
|
16
|
-
[32m@palmares/schemas:build:watch: [0m> tsc --project tsconfig.types.json --watch --preserveWatchOutput
|
17
|
-
[32m@palmares/schemas:build:watch: [0m
|
18
|
-
[32m@palmares/schemas:build:watch: [0mSuccessfully compiled: 32 files with swc (399.75ms)
|
19
|
-
[32m@palmares/schemas:build:watch: [0mWatching for file changes.
|
20
|
-
[32m@palmares/schemas:build:watch: [0mSuccessfully compiled: 32 files with swc (545.27ms)
|
21
|
-
[32m@palmares/schemas:build:watch: [0mWatching for file changes.
|
22
|
-
[32m@palmares/schemas:build:watch: [0m
|
23
|
-
[32m@palmares/schemas:build:watch: [0m8:20:09 PM - Starting compilation in watch mode...
|
24
|
-
[32m@palmares/schemas:build:watch: [0m
|
25
|
-
[32m@palmares/schemas:build:watch: [0m
|
26
|
-
[32m@palmares/schemas:build:watch: [0m8:20:11 PM - Found 0 errors. Watching for file changes.
|
@@ -1,22 +0,0 @@
|
|
1
|
-
CREATE TABLE `companies` (
|
2
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
3
|
-
`name` text(255) NOT NULL,
|
4
|
-
`translatable` real
|
5
|
-
);
|
6
|
-
--> statement-breakpoint
|
7
|
-
CREATE TABLE `users` (
|
8
|
-
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
9
|
-
`name` text(255),
|
10
|
-
`age` integer NOT NULL,
|
11
|
-
`updated_at` text NOT NULL,
|
12
|
-
`created_at` text NOT NULL,
|
13
|
-
`company_id` integer NOT NULL,
|
14
|
-
FOREIGN KEY (`company_id`) REFERENCES `companies`(`id`) ON UPDATE no action ON DELETE no action
|
15
|
-
);
|
16
|
-
--> statement-breakpoint
|
17
|
-
CREATE UNIQUE INDEX `companies_id_unique` ON `companies` (`id`);--> statement-breakpoint
|
18
|
-
CREATE UNIQUE INDEX `companies_id_idx` ON `companies` (`id`);--> statement-breakpoint
|
19
|
-
CREATE UNIQUE INDEX `users_id_unique` ON `users` (`id`);--> statement-breakpoint
|
20
|
-
CREATE UNIQUE INDEX `users_id_idx` ON `users` (`id`);--> statement-breakpoint
|
21
|
-
CREATE INDEX `users_name_idx` ON `users` (`name`);--> statement-breakpoint
|
22
|
-
CREATE INDEX `users_age_idx` ON `users` (`age`);
|
@@ -1,156 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": "6",
|
3
|
-
"dialect": "sqlite",
|
4
|
-
"id": "7061f150-4aa4-492f-af8d-ddc6e13ace25",
|
5
|
-
"prevId": "00000000-0000-0000-0000-000000000000",
|
6
|
-
"tables": {
|
7
|
-
"companies": {
|
8
|
-
"name": "companies",
|
9
|
-
"columns": {
|
10
|
-
"id": {
|
11
|
-
"name": "id",
|
12
|
-
"type": "integer",
|
13
|
-
"primaryKey": true,
|
14
|
-
"notNull": true,
|
15
|
-
"autoincrement": true
|
16
|
-
},
|
17
|
-
"name": {
|
18
|
-
"name": "name",
|
19
|
-
"type": "text(255)",
|
20
|
-
"primaryKey": false,
|
21
|
-
"notNull": true,
|
22
|
-
"autoincrement": false
|
23
|
-
},
|
24
|
-
"translatable": {
|
25
|
-
"name": "translatable",
|
26
|
-
"type": "real",
|
27
|
-
"primaryKey": false,
|
28
|
-
"notNull": false,
|
29
|
-
"autoincrement": false
|
30
|
-
}
|
31
|
-
},
|
32
|
-
"indexes": {
|
33
|
-
"companies_id_unique": {
|
34
|
-
"name": "companies_id_unique",
|
35
|
-
"columns": [
|
36
|
-
"id"
|
37
|
-
],
|
38
|
-
"isUnique": true
|
39
|
-
},
|
40
|
-
"companies_id_idx": {
|
41
|
-
"name": "companies_id_idx",
|
42
|
-
"columns": [
|
43
|
-
"id"
|
44
|
-
],
|
45
|
-
"isUnique": true
|
46
|
-
}
|
47
|
-
},
|
48
|
-
"foreignKeys": {},
|
49
|
-
"compositePrimaryKeys": {},
|
50
|
-
"uniqueConstraints": {}
|
51
|
-
},
|
52
|
-
"users": {
|
53
|
-
"name": "users",
|
54
|
-
"columns": {
|
55
|
-
"id": {
|
56
|
-
"name": "id",
|
57
|
-
"type": "integer",
|
58
|
-
"primaryKey": true,
|
59
|
-
"notNull": true,
|
60
|
-
"autoincrement": true
|
61
|
-
},
|
62
|
-
"name": {
|
63
|
-
"name": "name",
|
64
|
-
"type": "text(255)",
|
65
|
-
"primaryKey": false,
|
66
|
-
"notNull": false,
|
67
|
-
"autoincrement": false
|
68
|
-
},
|
69
|
-
"age": {
|
70
|
-
"name": "age",
|
71
|
-
"type": "integer",
|
72
|
-
"primaryKey": false,
|
73
|
-
"notNull": true,
|
74
|
-
"autoincrement": false
|
75
|
-
},
|
76
|
-
"updated_at": {
|
77
|
-
"name": "updated_at",
|
78
|
-
"type": "text",
|
79
|
-
"primaryKey": false,
|
80
|
-
"notNull": true,
|
81
|
-
"autoincrement": false
|
82
|
-
},
|
83
|
-
"created_at": {
|
84
|
-
"name": "created_at",
|
85
|
-
"type": "text",
|
86
|
-
"primaryKey": false,
|
87
|
-
"notNull": true,
|
88
|
-
"autoincrement": false
|
89
|
-
},
|
90
|
-
"company_id": {
|
91
|
-
"name": "company_id",
|
92
|
-
"type": "integer",
|
93
|
-
"primaryKey": false,
|
94
|
-
"notNull": true,
|
95
|
-
"autoincrement": false
|
96
|
-
}
|
97
|
-
},
|
98
|
-
"indexes": {
|
99
|
-
"users_id_unique": {
|
100
|
-
"name": "users_id_unique",
|
101
|
-
"columns": [
|
102
|
-
"id"
|
103
|
-
],
|
104
|
-
"isUnique": true
|
105
|
-
},
|
106
|
-
"users_id_idx": {
|
107
|
-
"name": "users_id_idx",
|
108
|
-
"columns": [
|
109
|
-
"id"
|
110
|
-
],
|
111
|
-
"isUnique": true
|
112
|
-
},
|
113
|
-
"users_name_idx": {
|
114
|
-
"name": "users_name_idx",
|
115
|
-
"columns": [
|
116
|
-
"name"
|
117
|
-
],
|
118
|
-
"isUnique": false
|
119
|
-
},
|
120
|
-
"users_age_idx": {
|
121
|
-
"name": "users_age_idx",
|
122
|
-
"columns": [
|
123
|
-
"age"
|
124
|
-
],
|
125
|
-
"isUnique": false
|
126
|
-
}
|
127
|
-
},
|
128
|
-
"foreignKeys": {
|
129
|
-
"users_company_id_companies_id_fk": {
|
130
|
-
"name": "users_company_id_companies_id_fk",
|
131
|
-
"tableFrom": "users",
|
132
|
-
"tableTo": "companies",
|
133
|
-
"columnsFrom": [
|
134
|
-
"company_id"
|
135
|
-
],
|
136
|
-
"columnsTo": [
|
137
|
-
"id"
|
138
|
-
],
|
139
|
-
"onDelete": "no action",
|
140
|
-
"onUpdate": "no action"
|
141
|
-
}
|
142
|
-
},
|
143
|
-
"compositePrimaryKeys": {},
|
144
|
-
"uniqueConstraints": {}
|
145
|
-
}
|
146
|
-
},
|
147
|
-
"enums": {},
|
148
|
-
"_meta": {
|
149
|
-
"schemas": {},
|
150
|
-
"tables": {},
|
151
|
-
"columns": {}
|
152
|
-
},
|
153
|
-
"internal": {
|
154
|
-
"indexes": {}
|
155
|
-
}
|
156
|
-
}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import * as d from 'drizzle-orm/sqlite-core';
|
2
|
-
import * as drzl from 'drizzle-orm';
|
3
|
-
|
4
|
-
export const Company = d.sqliteTable('companies', {
|
5
|
-
id: d.integer('id', { mode: 'number' }).primaryKey({ autoIncrement: true }).notNull().unique(),
|
6
|
-
name: d.text('name', { length: 255 }).notNull(),
|
7
|
-
translatable: d.real('translatable')
|
8
|
-
}, (table) => ({
|
9
|
-
idIdx: d.uniqueIndex('companies_id_idx').on(table.id)
|
10
|
-
}));
|
11
|
-
|
12
|
-
export const User = d.sqliteTable('users', {
|
13
|
-
id: d.integer('id', { mode: 'number' }).primaryKey({ autoIncrement: true }).notNull().unique(),
|
14
|
-
name: d.text('name', { length: 255 }),
|
15
|
-
age: d.integer('age', { mode: 'number' }).notNull(),
|
16
|
-
updatedAt: d.text('updated_at').notNull().$onUpdate(() => drzl.sql`CURRENT_TIMESTAMP`),
|
17
|
-
createdAt: d.text('created_at').notNull().$defaultFn(() => drzl.sql`CURRENT_TIMESTAMP`),
|
18
|
-
companyId: d.integer('company_id', { mode: 'number' }).notNull().references((): d.AnySQLiteColumn => Company.id)
|
19
|
-
}, (table) => ({
|
20
|
-
idIdx: d.uniqueIndex('users_id_idx').on(table.id),
|
21
|
-
nameIdx: d.index('users_name_idx').on(table.name),
|
22
|
-
ageIdx: d.index('users_age_idx').on(table.age)
|
23
|
-
}));
|
24
|
-
|
25
|
-
export const UserRelations = drzl.relations(User, (args) => ({
|
26
|
-
company: args.one(Company, {
|
27
|
-
fields: [User.companyId],
|
28
|
-
references: [Company.id]
|
29
|
-
})
|
30
|
-
}));
|
31
|
-
|
32
|
-
export const CompanyRelations = drzl.relations(Company, (args) => ({
|
33
|
-
usersOfCompany: args.many(User)
|
34
|
-
}));
|
35
|
-
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import config from '../../../eslint.config.js';
|
2
|
-
|
3
|
-
/** @type {import('eslint').Linter.RulesRecord} */
|
4
|
-
const configs = [{
|
5
|
-
...config[0],
|
6
|
-
name: '@palmares/schemas/tests',
|
7
|
-
files: ['src/**/*.ts', 'src/**/*.postgres.ts', 'manage.ts', 'drizzle.config.ts', '.drizzle/schema.ts'],
|
8
|
-
}];
|
9
|
-
|
10
|
-
export default configs;
|
package/__tests__/manage.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
-
|
4
|
-
case `uname` in
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
-
esac
|
7
|
-
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
9
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/drizzle-kit@0.23.0/node_modules/drizzle-kit/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/drizzle-kit@0.23.0/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules"
|
10
|
-
else
|
11
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/drizzle-kit@0.23.0/node_modules/drizzle-kit/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/drizzle-kit@0.23.0/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
-
fi
|
13
|
-
if [ -x "$basedir/node" ]; then
|
14
|
-
exec "$basedir/node" "$basedir/../drizzle-kit/bin.cjs" "$@"
|
15
|
-
else
|
16
|
-
exec node "$basedir/../drizzle-kit/bin.cjs" "$@"
|
17
|
-
fi
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
-
|
4
|
-
case `uname` in
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
-
esac
|
7
|
-
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
9
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules"
|
10
|
-
else
|
11
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
-
fi
|
13
|
-
if [ -x "$basedir/node" ]; then
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "$@"
|
15
|
-
else
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "$@"
|
17
|
-
fi
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
-
|
4
|
-
case `uname` in
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
-
esac
|
7
|
-
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
9
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules"
|
10
|
-
else
|
11
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
-
fi
|
13
|
-
if [ -x "$basedir/node" ]; then
|
14
|
-
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
15
|
-
else
|
16
|
-
exec node "$basedir/../typescript/bin/tsc" "$@"
|
17
|
-
fi
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
-
|
4
|
-
case `uname` in
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
-
esac
|
7
|
-
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
9
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules"
|
10
|
-
else
|
11
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/typescript@5.5.4/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
-
fi
|
13
|
-
if [ -x "$basedir/node" ]; then
|
14
|
-
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
15
|
-
else
|
16
|
-
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
17
|
-
fi
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
-
|
4
|
-
case `uname` in
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
-
esac
|
7
|
-
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
9
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/tsx@4.16.2/node_modules/tsx/dist/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/tsx@4.16.2/node_modules/tsx/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/tsx@4.16.2/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules"
|
10
|
-
else
|
11
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/tsx@4.16.2/node_modules/tsx/dist/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/tsx@4.16.2/node_modules/tsx/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/tsx@4.16.2/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
-
fi
|
13
|
-
if [ -x "$basedir/node" ]; then
|
14
|
-
exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
|
15
|
-
else
|
16
|
-
exec node "$basedir/../tsx/dist/cli.mjs" "$@"
|
17
|
-
fi
|
package/__tests__/package.json
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@tests/schemas",
|
3
|
-
"version": "0.0.1",
|
4
|
-
"description": "testing the server",
|
5
|
-
"main": "manage.ts",
|
6
|
-
"scripts": {
|
7
|
-
"test": "tsx manage.ts test",
|
8
|
-
"test:watch": "WATCH=true tsx manage.ts test"
|
9
|
-
},
|
10
|
-
"keywords": [],
|
11
|
-
"author": "",
|
12
|
-
"license": "ISC",
|
13
|
-
"dependencies": {
|
14
|
-
"@palmares/console-logging": "workspace:*",
|
15
|
-
"@palmares/core": "workspace:*",
|
16
|
-
"@palmares/databases": "workspace:*",
|
17
|
-
"@palmares/drizzle-engine": "workspace:*",
|
18
|
-
"@palmares/express-adapter": "workspace:*",
|
19
|
-
"@palmares/jest-tests": "workspace:*",
|
20
|
-
"@palmares/logging": "workspace:*",
|
21
|
-
"@palmares/node-std": "workspace:*",
|
22
|
-
"@palmares/schemas": "workspace:*",
|
23
|
-
"@palmares/tests": "workspace:*",
|
24
|
-
"@palmares/zod-schema": "workspace:*",
|
25
|
-
"better-sqlite3": "^11.1.2",
|
26
|
-
"drizzle-kit": "^0.23.0",
|
27
|
-
"drizzle-orm": "^0.32.0"
|
28
|
-
},
|
29
|
-
"devDependencies": {
|
30
|
-
"@types/better-sqlite3": "^7.6.11",
|
31
|
-
"tsx": "^4.16.2",
|
32
|
-
"typescript": "^5.5.4"
|
33
|
-
}
|
34
|
-
}
|
package/__tests__/sqlite.db
DELETED
File without changes
|
@@ -1,131 +0,0 @@
|
|
1
|
-
import * as p from '@palmares/schemas';
|
2
|
-
import { describe } from '@palmares/tests';
|
3
|
-
|
4
|
-
import type JestTestAdapter from '@palmares/jest-tests';
|
5
|
-
|
6
|
-
describe<JestTestAdapter>('Array Tests', ({ test }) => {
|
7
|
-
test('optional', async ({ expect }) => {
|
8
|
-
const arraySchema = p.array([p.number()]);
|
9
|
-
const tupleSchema = p.array(p.number(), p.string());
|
10
|
-
const arraySchemaWithCustomMessage = p.array([p.number()]).nonOptional({ message: 'hello' });
|
11
|
-
const tupleSchemaWithCustomMessage = p.array(p.number(), p.string()).nonOptional({ message: 'hello' });
|
12
|
-
|
13
|
-
const [
|
14
|
-
{ errors: errorsArrayOnFail },
|
15
|
-
{ errors: errorsTupleOnFail },
|
16
|
-
{ errors: errorsArrayOnFailWithCustomMessage },
|
17
|
-
{ errors: errorsTupleOnFailWithCustomMessage },
|
18
|
-
{ errors: errorsOnValidArray, parsed: parsedArray },
|
19
|
-
{ errors: errorsOnValidTuple, parsed: parsedTuple }
|
20
|
-
] = await Promise.all([
|
21
|
-
arraySchema.parse(undefined as any),
|
22
|
-
tupleSchema.parse(undefined as any),
|
23
|
-
arraySchemaWithCustomMessage.parse(undefined as any),
|
24
|
-
tupleSchemaWithCustomMessage.parse(undefined as any),
|
25
|
-
arraySchema.parse([1, 2, 3]),
|
26
|
-
tupleSchema.parse([1, 'test'])
|
27
|
-
]);
|
28
|
-
|
29
|
-
expect(errorsArrayOnFailWithCustomMessage?.[0]?.message).toBe('hello');
|
30
|
-
expect(errorsTupleOnFailWithCustomMessage?.[0]?.message).toBe('hello');
|
31
|
-
expect(errorsArrayOnFail?.[0]?.code).toBe('required');
|
32
|
-
expect(errorsArrayOnFail?.[0]?.message).toBe('Required');
|
33
|
-
expect(errorsTupleOnFail?.[0]?.code).toBe('required');
|
34
|
-
expect(errorsTupleOnFail?.[0]?.message).toBe('Required');
|
35
|
-
expect((errorsOnValidArray || []).length).toBe(0);
|
36
|
-
expect(parsedArray[0]).toBe(1);
|
37
|
-
expect(parsedArray[2]).toBe(3);
|
38
|
-
expect((errorsOnValidTuple || []).length).toBe(0);
|
39
|
-
expect(parsedTuple[0]).toBe(1);
|
40
|
-
expect(parsedTuple[1]).toBe('test');
|
41
|
-
});
|
42
|
-
|
43
|
-
test('nullable', async ({ expect }) => {
|
44
|
-
const arraySchema = p.array([p.number()]);
|
45
|
-
const tupleSchema = p.array(p.number(), p.string());
|
46
|
-
const arraySchemaWithCustomMessage = p.array([p.number()]).nonNullable({ message: 'hello' });
|
47
|
-
const tupleSchemaWithCustomMessage = p.array(p.number(), p.string()).nonNullable({ message: 'hello' });
|
48
|
-
|
49
|
-
const [
|
50
|
-
{ errors: errorsArrayOnFail },
|
51
|
-
{ errors: errorsTupleOnFail },
|
52
|
-
{ errors: errorsArrayOnFailWithCustomMessage },
|
53
|
-
{ errors: errorsTupleOnFailWithCustomMessage },
|
54
|
-
{ errors: errorsOnValidArray, parsed: parsedArray },
|
55
|
-
{ errors: errorsOnValidTuple, parsed: parsedTuple }
|
56
|
-
] = await Promise.all([
|
57
|
-
arraySchema.parse(null as any),
|
58
|
-
tupleSchema.parse(null as any),
|
59
|
-
arraySchemaWithCustomMessage.parse(null as any),
|
60
|
-
tupleSchemaWithCustomMessage.parse(null as any),
|
61
|
-
arraySchema.parse([1, 2, 3]),
|
62
|
-
tupleSchema.parse([1, 'test'])
|
63
|
-
]);
|
64
|
-
|
65
|
-
expect(errorsArrayOnFailWithCustomMessage?.[0]?.message).toBe('hello');
|
66
|
-
expect(errorsTupleOnFailWithCustomMessage?.[0]?.message).toBe('hello');
|
67
|
-
expect(errorsArrayOnFail?.[0]?.code).toBe('null');
|
68
|
-
expect(errorsArrayOnFail?.[0]?.message).toBe('Cannot be null');
|
69
|
-
expect(errorsTupleOnFail?.[0]?.code).toBe('null');
|
70
|
-
expect(errorsTupleOnFail?.[0]?.message).toBe('Cannot be null');
|
71
|
-
expect((errorsOnValidArray || []).length).toBe(0);
|
72
|
-
expect(parsedArray[0]).toBe(1);
|
73
|
-
expect(parsedArray[2]).toBe(3);
|
74
|
-
expect((errorsOnValidTuple || []).length).toBe(0);
|
75
|
-
expect(parsedTuple[0]).toBe(1);
|
76
|
-
expect(parsedTuple[1]).toBe('test');
|
77
|
-
});
|
78
|
-
|
79
|
-
test('nested', async ({ expect }) => {
|
80
|
-
const arraySchema = p.array([p.union([p.number(), p.string().toRepresentation(async () => 'hey')])]);
|
81
|
-
|
82
|
-
const data = await arraySchema.data(['test', 1]);
|
83
|
-
|
84
|
-
console.log(data);
|
85
|
-
expect(data[0]).toBe('hey');
|
86
|
-
expect(data[1]).toBe(1)
|
87
|
-
});
|
88
|
-
|
89
|
-
test('min length', async ({ expect }) => {
|
90
|
-
const arraySchema = p.array([p.number()]).minLength(1);
|
91
|
-
const arraySchemaWithCustomMessage = p.array([p.number()]).minLength(1, { inclusive: true, message: 'hello' });
|
92
|
-
|
93
|
-
const [
|
94
|
-
{ errors: errorsArrayOnFail },
|
95
|
-
{ errors: errorsArrayOnFailWithCustomMessage },
|
96
|
-
{ errors: errorsOnValidArray, parsed: parsedArray }
|
97
|
-
] = await Promise.all([
|
98
|
-
arraySchema.parse([] as any),
|
99
|
-
arraySchemaWithCustomMessage.parse([] as any),
|
100
|
-
arraySchema.parse([1, 2, 3])
|
101
|
-
]);
|
102
|
-
|
103
|
-
expect(errorsArrayOnFailWithCustomMessage?.[0]?.message).toBe('hello');
|
104
|
-
expect(errorsArrayOnFail?.[0]?.code).toBe('minLength');
|
105
|
-
expect(errorsArrayOnFail?.[0]?.message).toBe('The array must have a minimum length of 1');
|
106
|
-
expect((errorsOnValidArray || []).length).toBe(0);
|
107
|
-
expect(parsedArray[0]).toBe(1);
|
108
|
-
expect(parsedArray[2]).toBe(3);
|
109
|
-
});
|
110
|
-
|
111
|
-
test('max length', async ({ expect }) => {
|
112
|
-
const arraySchema = p.array([p.number()]).maxLength(1);
|
113
|
-
const arraySchemaWithCustomMessage = p.array([p.number()]).maxLength(1, { inclusive: true, message: 'hello' });
|
114
|
-
|
115
|
-
const [
|
116
|
-
{ errors: errorsArrayOnFail },
|
117
|
-
{ errors: errorsArrayOnFailWithCustomMessage },
|
118
|
-
{ errors: errorsOnValidArray, parsed: parsedArray }
|
119
|
-
] = await Promise.all([
|
120
|
-
arraySchema.parse([1, 2, 3] as any),
|
121
|
-
arraySchemaWithCustomMessage.parse([1, 2, 3] as any),
|
122
|
-
arraySchema.parse([1])
|
123
|
-
]);
|
124
|
-
|
125
|
-
expect(errorsArrayOnFailWithCustomMessage?.[0]?.message).toBe('hello');
|
126
|
-
expect(errorsArrayOnFail?.[0]?.code).toBe('maxLength');
|
127
|
-
expect(errorsArrayOnFail?.[0]?.message).toBe('The array must have a maximum length of 1');
|
128
|
-
expect((errorsOnValidArray || []).length).toBe(0);
|
129
|
-
expect(parsedArray[0]).toBe(1);
|
130
|
-
});
|
131
|
-
});
|