@logto/schemas 1.24.1 → 1.25.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.
@@ -0,0 +1,35 @@
1
+ import { sql } from '@silverhand/slonik';
2
+
3
+ import type { AlterationScript } from '../lib/types/alteration.js';
4
+
5
+ const alteration: AlterationScript = {
6
+ up: async (pool) => {
7
+ await pool.query(sql`
8
+ alter type users_password_encryption_method add value 'Legacy';
9
+ `);
10
+ },
11
+ down: async (pool) => {
12
+ const { rows } = await pool.query(sql`
13
+ select id from users
14
+ where password_encryption_method = ${'Legacy'}
15
+ `);
16
+ if (rows.length > 0) {
17
+ throw new Error('There are users with password encryption method Legacy.');
18
+ }
19
+
20
+ await pool.query(sql`
21
+ create type users_password_encryption_method_revised as enum (
22
+ 'Argon2i', 'Argon2id', 'Argon2d', 'SHA1', 'SHA256', 'MD5', 'Bcrypt'
23
+ );
24
+
25
+ alter table users
26
+ alter column password_encryption_method type users_password_encryption_method_revised
27
+ using password_encryption_method::text::users_password_encryption_method_revised;
28
+
29
+ drop type users_password_encryption_method;
30
+ alter type users_password_encryption_method_revised rename to users_password_encryption_method;
31
+ `);
32
+ },
33
+ };
34
+
35
+ export default alteration;
@@ -0,0 +1,30 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter type users_password_encryption_method add value 'Legacy';
6
+ `);
7
+ },
8
+ down: async (pool) => {
9
+ const { rows } = await pool.query(sql `
10
+ select id from users
11
+ where password_encryption_method = ${'Legacy'}
12
+ `);
13
+ if (rows.length > 0) {
14
+ throw new Error('There are users with password encryption method Legacy.');
15
+ }
16
+ await pool.query(sql `
17
+ create type users_password_encryption_method_revised as enum (
18
+ 'Argon2i', 'Argon2id', 'Argon2d', 'SHA1', 'SHA256', 'MD5', 'Bcrypt'
19
+ );
20
+
21
+ alter table users
22
+ alter column password_encryption_method type users_password_encryption_method_revised
23
+ using password_encryption_method::text::users_password_encryption_method_revised;
24
+
25
+ drop type users_password_encryption_method;
26
+ alter type users_password_encryption_method_revised rename to users_password_encryption_method;
27
+ `);
28
+ },
29
+ };
30
+ export default alteration;
@@ -43,5 +43,6 @@ export declare enum UsersPasswordEncryptionMethod {
43
43
  SHA1 = "SHA1",
44
44
  SHA256 = "SHA256",
45
45
  MD5 = "MD5",
46
- Bcrypt = "Bcrypt"
46
+ Bcrypt = "Bcrypt",
47
+ Legacy = "Legacy"
47
48
  }
@@ -53,4 +53,5 @@ export var UsersPasswordEncryptionMethod;
53
53
  UsersPasswordEncryptionMethod["SHA256"] = "SHA256";
54
54
  UsersPasswordEncryptionMethod["MD5"] = "MD5";
55
55
  UsersPasswordEncryptionMethod["Bcrypt"] = "Bcrypt";
56
+ UsersPasswordEncryptionMethod["Legacy"] = "Legacy";
56
57
  })(UsersPasswordEncryptionMethod || (UsersPasswordEncryptionMethod = {}));
@@ -1,48 +1 @@
1
- import { z } from 'zod';
2
- export { TemplateType, templateTypeGuard } from '@logto/connector-kit';
3
- export type EmailTemplateDetails = {
4
- subject: string;
5
- content: string;
6
- /**
7
- * OPTIONAL: The content type of the email template.
8
- *
9
- * Some email clients may render email templates differently based on the content type. (e.g. Sendgrid, Mailgun)
10
- * Use this field to specify the content type of the email template.
11
- */
12
- contentType?: 'text/html' | 'text/plain';
13
- /**
14
- * OPTIONAL: Custom replyTo template.
15
- *
16
- * Based on the email client, the replyTo field may be used to customize the reply-to field of the email.
17
- * @remarks
18
- * The original reply email value can be found in the template variables.
19
- */
20
- replyTo?: string;
21
- /**
22
- * OPTIONAL: Custom from template.
23
- *
24
- * Based on the email client, the sendFrom field may be used to customize the from field of the email.
25
- * @remarks
26
- * The sender email value can be found in the template variables.
27
- */
28
- sendFrom?: string;
29
- };
30
- export declare const emailTemplateDetailsGuard: z.ZodObject<{
31
- subject: z.ZodString;
32
- content: z.ZodString;
33
- contentType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"text/html">, z.ZodLiteral<"text/plain">]>>;
34
- replyTo: z.ZodOptional<z.ZodString>;
35
- sendFrom: z.ZodOptional<z.ZodString>;
36
- }, "strip", z.ZodTypeAny, {
37
- subject: string;
38
- content: string;
39
- contentType?: "text/html" | "text/plain" | undefined;
40
- replyTo?: string | undefined;
41
- sendFrom?: string | undefined;
42
- }, {
43
- subject: string;
44
- content: string;
45
- contentType?: "text/html" | "text/plain" | undefined;
46
- replyTo?: string | undefined;
47
- sendFrom?: string | undefined;
48
- }>;
1
+ export { TemplateType, templateTypeGuard, type EmailTemplateDetails, emailTemplateDetailsGuard, } from '@logto/connector-kit';
@@ -1,9 +1 @@
1
- import { z } from 'zod';
2
- export { TemplateType, templateTypeGuard } from '@logto/connector-kit';
3
- export const emailTemplateDetailsGuard = z.object({
4
- subject: z.string(),
5
- content: z.string(),
6
- contentType: z.union([z.literal('text/html'), z.literal('text/plain')]).optional(),
7
- replyTo: z.string().optional(),
8
- sendFrom: z.string().optional(),
9
- });
1
+ export { TemplateType, templateTypeGuard, emailTemplateDetailsGuard, } from '@logto/connector-kit';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/schemas",
3
- "version": "1.24.1",
3
+ "version": "1.25.0",
4
4
  "author": "Silverhand Inc. <contact@silverhand.io>",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "prettier": "@silverhand/eslint-config/.prettierrc",
65
65
  "dependencies": {
66
- "@logto/connector-kit": "^4.1.1",
66
+ "@logto/connector-kit": "^4.2.0",
67
67
  "@logto/core-kit": "^2.5.4",
68
68
  "@logto/language-kit": "^1.1.1",
69
69
  "@logto/phrases": "^1.18.0",
package/tables/users.sql CHANGED
@@ -1,6 +1,6 @@
1
1
  /* init_order = 1 */
2
2
 
3
- create type users_password_encryption_method as enum ('Argon2i', 'Argon2id', 'Argon2d', 'SHA1', 'SHA256', 'MD5', 'Bcrypt');
3
+ create type users_password_encryption_method as enum ('Argon2i', 'Argon2id', 'Argon2d', 'SHA1', 'SHA256', 'MD5', 'Bcrypt', 'Legacy');
4
4
 
5
5
  create table users (
6
6
  tenant_id varchar(21) not null