@webamoki/web-svelte 1.2.3 → 2.0.0

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 (117) hide show
  1. package/README.md +3 -1
  2. package/dist/components/showcase/CodeBlock.svelte +1 -1
  3. package/dist/{components → shared/components}/form/Button.svelte +2 -2
  4. package/dist/{components → shared/components}/form/Button.svelte.d.ts +2 -2
  5. package/dist/{components → shared/components}/form/Errors.svelte +1 -1
  6. package/dist/{components → shared/components}/form/FieldWrapper.svelte +1 -1
  7. package/dist/{components → shared/components}/form/fields/ChoiceMultiField.svelte +3 -1
  8. package/dist/{components → shared/components}/form/fields/DateField.svelte +2 -2
  9. package/dist/{components → shared/components}/form/fields/MessageField.svelte +2 -2
  10. package/dist/{components → shared/components}/form/fields/NumberField.svelte +2 -2
  11. package/dist/{components → shared/components}/form/fields/PasswordField.svelte +2 -2
  12. package/dist/{components → shared/components}/form/fields/SelectField.svelte +3 -3
  13. package/dist/{components → shared/components}/form/fields/SelectMultiField.svelte +3 -3
  14. package/dist/{components → shared/components}/form/fields/TextField.svelte +2 -2
  15. package/dist/{components → shared/components}/form/fields/TextFieldNullable.svelte +2 -2
  16. package/dist/{components → shared/components}/form/fields/TimeField.svelte +2 -2
  17. package/dist/{components → shared/components}/ui/choice/ChoiceInternal.svelte +1 -1
  18. package/dist/{components → shared/components}/ui/choice/WeekdayChoice.svelte +6 -3
  19. package/dist/{components → shared/components}/ui/choice/WeekdayChoice.svelte.d.ts +1 -1
  20. package/dist/{components → shared/components}/ui/choice/WeekdayChoiceMulti.svelte +6 -3
  21. package/dist/{components → shared/components}/ui/choice/WeekdayChoiceMulti.svelte.d.ts +1 -1
  22. package/dist/{components → shared/components}/ui/context-menu/ContextMenuContent.svelte +1 -1
  23. package/dist/{components → shared/components}/ui/context-menu/ContextMenuItem.svelte +1 -1
  24. package/dist/{components → shared/components}/ui/search/SearchBar.svelte +2 -2
  25. package/dist/{utils/types → shared/utils}/arktype.d.ts +4 -12
  26. package/dist/shared/utils/arktype.js +40 -0
  27. package/dist/{utils → shared/utils}/datetime/datetime.spec.js +31 -18
  28. package/dist/{utils → shared/utils}/datetime/index.d.ts +22 -14
  29. package/dist/{utils → shared/utils}/datetime/index.js +44 -32
  30. package/dist/{utils → shared/utils}/email/README.md +5 -5
  31. package/dist/{utils → shared/utils}/email/ses.js +17 -9
  32. package/dist/shared/utils/functional/index.d.ts +2 -0
  33. package/dist/shared/utils/functional/index.js +2 -0
  34. package/dist/shared/utils/functional/result.d.ts +72 -0
  35. package/dist/shared/utils/functional/result.js +86 -0
  36. package/dist/shared/utils/functional/result.spec.d.ts +1 -0
  37. package/dist/shared/utils/functional/result.spec.js +96 -0
  38. package/dist/shared/utils/remote.d.ts +28 -0
  39. package/dist/shared/utils/remote.js +74 -0
  40. package/dist/{utils/search.d.ts → shared/utils/string.d.ts} +1 -0
  41. package/dist/{utils/search.js → shared/utils/string.js} +13 -4
  42. package/package.json +27 -30
  43. package/dist/utils/email/aws-signer.d.ts +0 -17
  44. package/dist/utils/email/aws-signer.js +0 -83
  45. package/dist/utils/string.d.ts +0 -1
  46. package/dist/utils/string.js +0 -4
  47. package/dist/utils/types/arktype.js +0 -92
  48. package/dist/utils/types/consts.d.ts +0 -5
  49. package/dist/utils/types/consts.js +0 -5
  50. package/dist/utils/types/db.d.ts +0 -57
  51. package/dist/utils/types/db.js +0 -34
  52. /package/dist/{components → shared/components}/form/Errors.svelte.d.ts +0 -0
  53. /package/dist/{components → shared/components}/form/FieldWrapper.svelte.d.ts +0 -0
  54. /package/dist/{components → shared/components}/form/Form.svelte +0 -0
  55. /package/dist/{components → shared/components}/form/Form.svelte.d.ts +0 -0
  56. /package/dist/{components → shared/components}/form/IconInputWrapper.svelte +0 -0
  57. /package/dist/{components → shared/components}/form/IconInputWrapper.svelte.d.ts +0 -0
  58. /package/dist/{components → shared/components}/form/fields/ChoiceField.svelte +0 -0
  59. /package/dist/{components → shared/components}/form/fields/ChoiceField.svelte.d.ts +0 -0
  60. /package/dist/{components → shared/components}/form/fields/ChoiceMultiField.svelte.d.ts +0 -0
  61. /package/dist/{components → shared/components}/form/fields/DateField.svelte.d.ts +0 -0
  62. /package/dist/{components → shared/components}/form/fields/HexColorField.svelte +0 -0
  63. /package/dist/{components → shared/components}/form/fields/HexColorField.svelte.d.ts +0 -0
  64. /package/dist/{components → shared/components}/form/fields/MessageField.svelte.d.ts +0 -0
  65. /package/dist/{components → shared/components}/form/fields/NumberField.svelte.d.ts +0 -0
  66. /package/dist/{components → shared/components}/form/fields/PasswordField.svelte.d.ts +0 -0
  67. /package/dist/{components → shared/components}/form/fields/SelectField.svelte.d.ts +0 -0
  68. /package/dist/{components → shared/components}/form/fields/SelectMultiField.svelte.d.ts +0 -0
  69. /package/dist/{components → shared/components}/form/fields/TextField.svelte.d.ts +0 -0
  70. /package/dist/{components → shared/components}/form/fields/TextFieldNullable.svelte.d.ts +0 -0
  71. /package/dist/{components → shared/components}/form/fields/TimeField.svelte.d.ts +0 -0
  72. /package/dist/{components → shared/components}/form/fields/WeekdayChoiceField.svelte +0 -0
  73. /package/dist/{components → shared/components}/form/fields/WeekdayChoiceField.svelte.d.ts +0 -0
  74. /package/dist/{components → shared/components}/form/fields/WeekdayChoiceMultiField.svelte +0 -0
  75. /package/dist/{components → shared/components}/form/fields/WeekdayChoiceMultiField.svelte.d.ts +0 -0
  76. /package/dist/{components → shared/components}/form/index.d.ts +0 -0
  77. /package/dist/{components → shared/components}/form/index.js +0 -0
  78. /package/dist/{components → shared/components}/ui/choice/Choice.svelte +0 -0
  79. /package/dist/{components → shared/components}/ui/choice/Choice.svelte.d.ts +0 -0
  80. /package/dist/{components → shared/components}/ui/choice/ChoiceInternal.svelte.d.ts +0 -0
  81. /package/dist/{components → shared/components}/ui/choice/ChoiceMulti.svelte +0 -0
  82. /package/dist/{components → shared/components}/ui/choice/ChoiceMulti.svelte.d.ts +0 -0
  83. /package/dist/{components → shared/components}/ui/context-menu/ContextMenu.svelte +0 -0
  84. /package/dist/{components → shared/components}/ui/context-menu/ContextMenu.svelte.d.ts +0 -0
  85. /package/dist/{components → shared/components}/ui/context-menu/ContextMenuContent.svelte.d.ts +0 -0
  86. /package/dist/{components → shared/components}/ui/context-menu/ContextMenuItem.svelte.d.ts +0 -0
  87. /package/dist/{components → shared/components}/ui/context-menu/ContextMenuSeparator.svelte +0 -0
  88. /package/dist/{components → shared/components}/ui/context-menu/ContextMenuSeparator.svelte.d.ts +0 -0
  89. /package/dist/{components → shared/components}/ui/context-menu/ContextMenuTrigger.svelte +0 -0
  90. /package/dist/{components → shared/components}/ui/context-menu/ContextMenuTrigger.svelte.d.ts +0 -0
  91. /package/dist/{components → shared/components}/ui/context-menu/context-menu-state.svelte.d.ts +0 -0
  92. /package/dist/{components → shared/components}/ui/context-menu/context-menu-state.svelte.js +0 -0
  93. /package/dist/{components → shared/components}/ui/drag-drop/Draggable.svelte +0 -0
  94. /package/dist/{components → shared/components}/ui/drag-drop/Draggable.svelte.d.ts +0 -0
  95. /package/dist/{components → shared/components}/ui/drag-drop/Dropzone.svelte +0 -0
  96. /package/dist/{components → shared/components}/ui/drag-drop/Dropzone.svelte.d.ts +0 -0
  97. /package/dist/{components → shared/components}/ui/drag-drop/drag-manager.d.ts +0 -0
  98. /package/dist/{components → shared/components}/ui/drag-drop/drag-manager.js +0 -0
  99. /package/dist/{components → shared/components}/ui/index.d.ts +0 -0
  100. /package/dist/{components → shared/components}/ui/index.js +0 -0
  101. /package/dist/{components → shared/components}/ui/search/SearchBar.svelte.d.ts +0 -0
  102. /package/dist/{server → shared/server}/form-handler.d.ts +0 -0
  103. /package/dist/{server → shared/server}/form-handler.js +0 -0
  104. /package/dist/{server → shared/server}/form-processor.d.ts +0 -0
  105. /package/dist/{server → shared/server}/form-processor.js +0 -0
  106. /package/dist/{utils → shared/utils}/datetime/datetime.spec.d.ts +0 -0
  107. /package/dist/{utils → shared/utils}/email/index.d.ts +0 -0
  108. /package/dist/{utils → shared/utils}/email/index.js +0 -0
  109. /package/dist/{utils → shared/utils}/email/ses.d.ts +0 -0
  110. /package/dist/{utils → shared/utils}/email/ses.test.d.ts +0 -0
  111. /package/dist/{utils → shared/utils}/email/ses.test.js +0 -0
  112. /package/dist/{utils → shared/utils}/form/index.d.ts +0 -0
  113. /package/dist/{utils → shared/utils}/form/index.js +0 -0
  114. /package/dist/{utils → shared/utils}/form/virtual-form.d.ts +0 -0
  115. /package/dist/{utils → shared/utils}/form/virtual-form.js +0 -0
  116. /package/dist/{highlight.d.ts → utils/highlight.d.ts} +0 -0
  117. /package/dist/{highlight.js → utils/highlight.js} +0 -0
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "1.2.3",
7
+ "version": "2.0.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
@@ -19,48 +19,44 @@
19
19
  "type": "module",
20
20
  "exports": {
21
21
  "./components/form": {
22
- "types": "./dist/components/form/index.d.ts",
23
- "svelte": "./dist/components/form/index.js"
22
+ "types": "./dist/shared/components/form/index.d.ts",
23
+ "svelte": "./dist/shared/components/form/index.js"
24
24
  },
25
25
  "./components/ui": {
26
- "types": "./dist/components/ui/index.d.ts",
27
- "svelte": "./dist/components/ui/index.js"
26
+ "types": "./dist/shared/components/ui/index.d.ts",
27
+ "svelte": "./dist/shared/components/ui/index.js"
28
28
  },
29
29
  "./utils/datetime": {
30
- "types": "./dist/utils/datetime/index.d.ts",
31
- "import": "./dist/utils/datetime/index.js"
30
+ "types": "./dist/shared/utils/datetime/index.d.ts",
31
+ "import": "./dist/shared/utils/datetime/index.js"
32
32
  },
33
- "./utils/types/arktype": {
34
- "types": "./dist/utils/types/arktype.d.ts",
35
- "import": "./dist/utils/types/arktype.js"
36
- },
37
- "./utils/types/consts": {
38
- "types": "./dist/utils/types/consts.d.ts",
39
- "import": "./dist/utils/types/consts.js"
40
- },
41
- "./utils/types/db": {
42
- "types": "./dist/utils/types/db.d.ts",
43
- "import": "./dist/utils/types/db.js"
33
+ "./utils/arktype": {
34
+ "types": "./dist/shared/utils/arktype.d.ts",
35
+ "import": "./dist/shared/utils/arktype.js"
44
36
  },
45
37
  "./utils/form": {
46
- "types": "./dist/utils/form/index.d.ts",
47
- "import": "./dist/utils/form/index.js"
38
+ "types": "./dist/shared/utils/form/index.d.ts",
39
+ "import": "./dist/shared/utils/form/index.js"
48
40
  },
49
41
  "./utils/email": {
50
- "types": "./dist/utils/email/index.d.ts",
51
- "import": "./dist/utils/email/index.js"
42
+ "types": "./dist/shared/utils/email/index.d.ts",
43
+ "import": "./dist/shared/utils/email/index.js"
44
+ },
45
+ "./utils/functional": {
46
+ "types": "./dist/shared/utils/functional/index.d.ts",
47
+ "import": "./dist/shared/utils/functional/index.js"
52
48
  },
53
49
  "./server/form-handler": {
54
- "types": "./dist/server/form-handler.d.ts",
55
- "import": "./dist/server/form-handler.js"
50
+ "types": "./dist/shared/server/form-handler.d.ts",
51
+ "import": "./dist/shared/server/form-handler.js"
56
52
  },
57
53
  "./server/form-processor": {
58
- "types": "./dist/server/form-processor.d.ts",
59
- "import": "./dist/server/form-processor.js"
54
+ "types": "./dist/shared/server/form-processor.d.ts",
55
+ "import": "./dist/shared/server/form-processor.js"
60
56
  },
61
- "./utils/search": {
62
- "types": "./dist/utils/search.d.ts",
63
- "import": "./dist/utils/search.js"
57
+ "./utils/remote": {
58
+ "types": "./dist/shared/utils/remote.d.ts",
59
+ "import": "./dist/shared/utils/remote.js"
64
60
  }
65
61
  },
66
62
  "peerDependencies": {
@@ -78,6 +74,7 @@
78
74
  "@eslint/compat": "^2.0.3",
79
75
  "@eslint/js": "^9.39.4",
80
76
  "@internationalized/date": "^3.12.0",
77
+ "@standard-schema/spec": "^1.1.0",
81
78
  "@sveltejs/adapter-static": "^3.0.10",
82
79
  "@sveltejs/kit": "^2.55.0",
83
80
  "@sveltejs/package": "^2.5.7",
@@ -120,9 +117,9 @@
120
117
  ],
121
118
  "dependencies": {
122
119
  "@lucide/svelte": "^1.6.0",
120
+ "aws4fetch": "^1.0.20",
123
121
  "bits-ui": "^2.16.3",
124
122
  "devalue": "^5.6.4",
125
- "drizzle-orm": "^0.45.1",
126
123
  "formsnap": "^2.0.1",
127
124
  "ramda": "^0.32.0",
128
125
  "sorted-array-functions": "^1.3.0",
@@ -1,17 +0,0 @@
1
- /**
2
- * AWS Signature Version 4 signing utilities for SES API
3
- * Compatible with Cloudflare Workers and other edge runtimes
4
- */
5
- interface AwsCredentials {
6
- accessKeyId: string;
7
- region: string;
8
- secretAccessKey: string;
9
- }
10
- /**
11
- * Create AWS Signature V4 authorization header
12
- */
13
- export declare function signRequest(method: string, host: string, path: string, body: string, credentials: AwsCredentials, service?: string): Promise<{
14
- headers: Record<string, string>;
15
- signedHeaders: string;
16
- }>;
17
- export {};
@@ -1,83 +0,0 @@
1
- /**
2
- * AWS Signature Version 4 signing utilities for SES API
3
- * Compatible with Cloudflare Workers and other edge runtimes
4
- */
5
- /**
6
- * Create AWS Signature V4 authorization header
7
- */
8
- export async function signRequest(method, host, path, body, credentials, service = 'ses') {
9
- const { accessKeyId, region, secretAccessKey } = credentials;
10
- // Create timestamp
11
- const now = new Date();
12
- const amzDate = now.toISOString().replace(/[:-]|\.\d{3}/g, ''); // Format: YYYYMMDDTHHMMSSZ
13
- const dateStamp = amzDate.slice(0, 8); // Format: YYYYMMDD
14
- // Hash the request body
15
- const payloadHash = bufferToHex(await sha256(body));
16
- // Create canonical headers
17
- const canonicalHeaders = `host:${host}\n` + `x-amz-date:${amzDate}\n`;
18
- const signedHeaders = 'host;x-amz-date';
19
- // Create canonical request
20
- const canonicalRequest = `${method}\n` +
21
- `${path}\n` +
22
- `\n` + // Empty query string
23
- `${canonicalHeaders}\n` +
24
- `${signedHeaders}\n` +
25
- `${payloadHash}`;
26
- // Create string to sign
27
- const algorithm = 'AWS4-HMAC-SHA256';
28
- const credentialScope = `${dateStamp}/${region}/${service}/aws4_request`;
29
- const canonicalRequestHash = bufferToHex(await sha256(canonicalRequest));
30
- const stringToSign = `${algorithm}\n` + `${amzDate}\n` + `${credentialScope}\n` + `${canonicalRequestHash}`;
31
- // Calculate signature
32
- const signingKey = await getSignatureKey(secretAccessKey, dateStamp, region, service);
33
- const signature = bufferToHex(await hmacSha256(signingKey, stringToSign));
34
- // Create authorization header
35
- const authorizationHeader = `${algorithm} ` +
36
- `Credential=${accessKeyId}/${credentialScope}, ` +
37
- `SignedHeaders=${signedHeaders}, ` +
38
- `Signature=${signature}`;
39
- return {
40
- headers: {
41
- Authorization: authorizationHeader,
42
- 'Content-Type': 'application/x-www-form-urlencoded',
43
- 'X-Amz-Date': amzDate
44
- },
45
- signedHeaders
46
- };
47
- }
48
- /**
49
- * Convert ArrayBuffer to hex string
50
- */
51
- function bufferToHex(buffer) {
52
- return Array.from(new Uint8Array(buffer))
53
- .map((b) => b.toString(16).padStart(2, '0'))
54
- .join('');
55
- }
56
- /**
57
- * Get signing key for AWS Signature V4
58
- */
59
- async function getSignatureKey(key, dateStamp, regionName, serviceName) {
60
- const encoder = new TextEncoder();
61
- const kDate = await hmacSha256(encoder.encode('AWS4' + key), dateStamp);
62
- const kRegion = await hmacSha256(kDate, regionName);
63
- const kService = await hmacSha256(kRegion, serviceName);
64
- const kSigning = await hmacSha256(kService, 'aws4_request');
65
- return kSigning;
66
- }
67
- /**
68
- * Create a SHA-256 HMAC
69
- */
70
- async function hmacSha256(key, message) {
71
- const encoder = new TextEncoder();
72
- const keyData = key instanceof ArrayBuffer ? new Uint8Array(key) : key;
73
- const cryptoKey = await crypto.subtle.importKey('raw', keyData, { hash: 'SHA-256', name: 'HMAC' }, false, ['sign']);
74
- return await crypto.subtle.sign('HMAC', cryptoKey, encoder.encode(message));
75
- }
76
- /**
77
- * Create a SHA-256 hash
78
- */
79
- async function sha256(message) {
80
- const encoder = new TextEncoder();
81
- const data = encoder.encode(message);
82
- return await crypto.subtle.digest('SHA-256', data);
83
- }
@@ -1 +0,0 @@
1
- export declare function toTitleCase(str: string): string;
@@ -1,4 +0,0 @@
1
- /* --- String functions --- */
2
- export function toTitleCase(str) {
3
- return str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
4
- }
@@ -1,92 +0,0 @@
1
- import { CalendarDate as calendarImport, Time as timeImport } from '@internationalized/date';
2
- import { type } from 'arktype';
3
- import { Days } from '../datetime/index.js';
4
- import { toTitleCase } from '../string.js';
5
- import { EMAIL_MAX, FIRST_NAME_MAX, LAST_NAME_MAX, NAME_MAX } from './consts.js';
6
- // Phone arktype: allows "+", digits, and spaces only
7
- export const Phone = type('string').narrow((value, ctx) => {
8
- if (!/^[+0-9 ]+$/.test(value)) {
9
- return ctx.reject({
10
- problem: 'invalid phone number. Only +, digits, and spaces are allowed.'
11
- });
12
- }
13
- return true;
14
- });
15
- /** Type string which is trimmed before narrowing the type checking */
16
- export function trimTo(typeTo) {
17
- return type('string.trim').to(typeTo);
18
- }
19
- export const Day = type.enumerated(...Days);
20
- export const Time = type.instanceOf(timeImport).configure({
21
- problem: () => 'invalid time'
22
- });
23
- export const CalendarDate = type.instanceOf(calendarImport).configure({
24
- problem: () => 'invalid date'
25
- });
26
- export const HexColor = type('string').narrow((value, ctx) => {
27
- // Regex explanation:
28
- // ^ : start of string
29
- // [0-9A-Fa-f]{3} : three hex digits (short form)
30
- // ([0-9A-Fa-f]{3})? : optional three more digits (long form #RRGGBB)
31
- // $ : end of string
32
- if (!/^[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$/.test(value)) {
33
- return ctx.reject({
34
- problem: 'invalid hex color value'
35
- });
36
- }
37
- return true;
38
- });
39
- export const Email = trimTo(type('string.email')
40
- .configure({
41
- problem: () => 'invalid email address'
42
- })
43
- .atMostLength(EMAIL_MAX)).pipe((email) => email.toLowerCase());
44
- export const Name = trimTo(type.string.moreThanLength(0).atMostLength(NAME_MAX)).pipe(toTitleCase);
45
- export const FirstName = trimTo(type.string.moreThanLength(0).atMostLength(FIRST_NAME_MAX)).pipe(toTitleCase);
46
- export const LastName = trimTo(type.string.moreThanLength(0).atMostLength(LAST_NAME_MAX)).pipe(toTitleCase);
47
- export const Id = type('number >= 0');
48
- const passwordMaxLength = 20;
49
- const passwordMinLength = 8;
50
- const allowedChars = /^[A-Za-z0-9!@$#()]+$/;
51
- export const Password = type('string')
52
- .atLeastLength(passwordMinLength)
53
- .atMostLength(passwordMaxLength)
54
- .configure({
55
- problem: (ctx) => `Must be ${ctx.expected}`
56
- })
57
- .narrow((data, ctx) => {
58
- if (!allowedChars.test(data)) {
59
- return ctx.reject({
60
- problem: 'invalid characters. Only A–Z, a–z, 0–9, !@$#() are allowed.'
61
- });
62
- }
63
- if (!/[A-Z]/.test(data)) {
64
- return ctx.reject({
65
- problem: 'must contain at least one uppercase letter.'
66
- });
67
- }
68
- if (!/[a-z]/.test(data)) {
69
- return ctx.reject({
70
- problem: 'must contain at least one lowercase letter.'
71
- });
72
- }
73
- if (!/[0-9]/.test(data)) {
74
- return ctx.reject({
75
- problem: 'must contain at least one number.'
76
- });
77
- }
78
- if (!/[!@$#()]/.test(data)) {
79
- return ctx.reject({
80
- problem: 'must contain at least one special character (!@$#()).'
81
- });
82
- }
83
- return true;
84
- });
85
- export const Duration = type('number').narrow((value, ctx) => {
86
- if (!Number.isInteger(value) || value <= 0) {
87
- return ctx.reject({
88
- problem: 'invalid minutes'
89
- });
90
- }
91
- return true;
92
- });
@@ -1,5 +0,0 @@
1
- export declare const FIRST_NAME_MAX = 25;
2
- export declare const LAST_NAME_MAX = 25;
3
- export declare const NAME_MAX = 50;
4
- export declare const EMAIL_MAX = 100;
5
- export declare const HEX_COLOR_MAX = 6;
@@ -1,5 +0,0 @@
1
- export const FIRST_NAME_MAX = 25;
2
- export const LAST_NAME_MAX = 25;
3
- export const NAME_MAX = 50;
4
- export const EMAIL_MAX = 100;
5
- export const HEX_COLOR_MAX = 6;
@@ -1,57 +0,0 @@
1
- import type { CalendarDate } from '@internationalized/date';
2
- import { type Time } from '@internationalized/date';
3
- export declare function stringEnum<T extends string>(): import("drizzle-orm/column-builder", { with: { "resolution-mode": "require" } }).$Type<import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgVarcharBuilderInitial<"", [string, ...string[]], 50>, T>;
4
- export declare const name: () => import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgVarcharBuilderInitial<"", [string, ...string[]], 50>;
5
- export declare const hexColor: () => import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgVarcharBuilderInitial<"", [string, ...string[]], 6>;
6
- export declare const time: {
7
- (): import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgCustomColumnBuilder<{
8
- name: "";
9
- dataType: "custom";
10
- columnType: "PgCustomColumn";
11
- data: Time;
12
- driverParam: string;
13
- enumValues: undefined;
14
- }>;
15
- <TConfig extends Record<string, any>>(fieldConfig?: TConfig | undefined): import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgCustomColumnBuilder<{
16
- name: "";
17
- dataType: "custom";
18
- columnType: "PgCustomColumn";
19
- data: Time;
20
- driverParam: string;
21
- enumValues: undefined;
22
- }>;
23
- <TName extends string>(dbName: TName, fieldConfig?: unknown): import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgCustomColumnBuilder<{
24
- name: TName;
25
- dataType: "custom";
26
- columnType: "PgCustomColumn";
27
- data: Time;
28
- driverParam: string;
29
- enumValues: undefined;
30
- }>;
31
- };
32
- export declare const date: {
33
- (): import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgCustomColumnBuilder<{
34
- name: "";
35
- dataType: "custom";
36
- columnType: "PgCustomColumn";
37
- data: CalendarDate;
38
- driverParam: string;
39
- enumValues: undefined;
40
- }>;
41
- <TConfig extends Record<string, any>>(fieldConfig?: TConfig | undefined): import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgCustomColumnBuilder<{
42
- name: "";
43
- dataType: "custom";
44
- columnType: "PgCustomColumn";
45
- data: CalendarDate;
46
- driverParam: string;
47
- enumValues: undefined;
48
- }>;
49
- <TName extends string>(dbName: TName, fieldConfig?: unknown): import("drizzle-orm/pg-core", { with: { "resolution-mode": "require" } }).PgCustomColumnBuilder<{
50
- name: TName;
51
- dataType: "custom";
52
- columnType: "PgCustomColumn";
53
- data: CalendarDate;
54
- driverParam: string;
55
- enumValues: undefined;
56
- }>;
57
- };
@@ -1,34 +0,0 @@
1
- import { parseDate, parseTime } from '@internationalized/date';
2
- import { customType, varchar } from 'drizzle-orm/pg-core';
3
- import { HEX_COLOR_MAX, NAME_MAX } from './consts.js';
4
- // General
5
- const STRING_ENUM_MAX = 50;
6
- export function stringEnum() {
7
- return varchar({ length: STRING_ENUM_MAX }).$type();
8
- }
9
- export const name = () => varchar({ length: NAME_MAX });
10
- export const hexColor = () => varchar({ length: HEX_COLOR_MAX });
11
- // Date Time
12
- // TODO: Absolute date time
13
- export const time = customType({
14
- dataType() {
15
- return 'time(0)';
16
- },
17
- fromDriver(value) {
18
- return parseTime(value);
19
- },
20
- toDriver(time) {
21
- return time.toString();
22
- }
23
- });
24
- export const date = customType({
25
- dataType() {
26
- return 'date';
27
- },
28
- fromDriver(value) {
29
- return parseDate(value);
30
- },
31
- toDriver(date) {
32
- return date.toString();
33
- }
34
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes