@logto/schemas 1.32.0 → 1.33.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,19 @@
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
+ create index applications__type
9
+ on applications (tenant_id, type);
10
+ `);
11
+ },
12
+ down: async (pool) => {
13
+ await pool.query(sql`
14
+ drop index applications__type;
15
+ `);
16
+ },
17
+ };
18
+
19
+ export default alteration;
@@ -0,0 +1,19 @@
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
+ create index roles__type
9
+ on roles (tenant_id, type);
10
+ `);
11
+ },
12
+ down: async (pool) => {
13
+ await pool.query(sql`
14
+ drop index roles__type;
15
+ `);
16
+ },
17
+ };
18
+
19
+ export default alteration;
@@ -0,0 +1,20 @@
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 table sign_in_experiences
9
+ add column hide_logto_branding boolean not null default false;
10
+ `);
11
+ },
12
+ down: async (pool) => {
13
+ await pool.query(sql`
14
+ alter table sign_in_experiences
15
+ drop column hide_logto_branding;
16
+ `);
17
+ },
18
+ };
19
+
20
+ export default alteration;
@@ -0,0 +1,15 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ create index applications__type
6
+ on applications (tenant_id, type);
7
+ `);
8
+ },
9
+ down: async (pool) => {
10
+ await pool.query(sql `
11
+ drop index applications__type;
12
+ `);
13
+ },
14
+ };
15
+ export default alteration;
@@ -0,0 +1,15 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ create index roles__type
6
+ on roles (tenant_id, type);
7
+ `);
8
+ },
9
+ down: async (pool) => {
10
+ await pool.query(sql `
11
+ drop index roles__type;
12
+ `);
13
+ },
14
+ };
15
+ export default alteration;
@@ -0,0 +1,16 @@
1
+ import { sql } from '@silverhand/slonik';
2
+ const alteration = {
3
+ up: async (pool) => {
4
+ await pool.query(sql `
5
+ alter table sign_in_experiences
6
+ add column hide_logto_branding boolean not null default false;
7
+ `);
8
+ },
9
+ down: async (pool) => {
10
+ await pool.query(sql `
11
+ alter table sign_in_experiences
12
+ drop column hide_logto_branding;
13
+ `);
14
+ },
15
+ };
16
+ export default alteration;
@@ -6,3 +6,4 @@ export * from './tenant.js';
6
6
  export * from './subscriptions.js';
7
7
  export * from './experience.js';
8
8
  export * from './sentinel.js';
9
+ export * from './product-event.js';
@@ -6,3 +6,4 @@ export * from './tenant.js';
6
6
  export * from './subscriptions.js';
7
7
  export * from './experience.js';
8
8
  export * from './sentinel.js';
9
+ export * from './product-event.js';
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The product events that Logto Cloud uses for analytics and auditing.
3
+ *
4
+ * - All events should be in past tense, with the format of `<noun> <verb>`.
5
+ * - Unless otherwise specified, all events should contain tenant ID as the
6
+ * `tenant` group distinct ID.
7
+ *
8
+ * @remarks
9
+ * Events that are tracked in the cloud service will be marked with `@cloud`.
10
+ */
11
+ export declare enum ProductEvent {
12
+ /** @cloud */
13
+ TenantCreated = "tenant created",
14
+ /** @cloud */
15
+ TenantDeleted = "tenant deleted",
16
+ /**
17
+ * One or more collaborators have been invited to the Logto Cloud tenant.
18
+ *
19
+ * @cloud
20
+ */
21
+ CollaboratorInvited = "collaborator invited",
22
+ /**
23
+ * The Logto Cloud tenant has subscribed to the Pro plan. It may be the first time subscribing,
24
+ * switching from the Free plan, or converting from a dev tenant, etc.
25
+ *
26
+ * @cloud
27
+ */
28
+ ProPlanSubscribed = "pro plan subscribed",
29
+ /**
30
+ * The Logto Cloud tenant has canceled the Pro plan.
31
+ *
32
+ * @cloud
33
+ */
34
+ ProPlanCanceled = "pro plan canceled",
35
+ /**
36
+ * The Logto Cloud tenant has subscribed to the Free plan. This may happen when a tenant
37
+ * newly created or downgrading from the Pro plan.
38
+ *
39
+ * @cloud
40
+ */
41
+ FreePlanSubscribed = "free plan subscribed",
42
+ /**
43
+ * A user has been created in the admin tenant. Interactive and non-interactive creations are
44
+ * both included.
45
+ */
46
+ DeveloperCreated = "developer created",
47
+ /** A user has been deleted in the admin tenant. */
48
+ DeveloperDeleted = "developer deleted",
49
+ AccessTokenIssued = "access token issued",
50
+ AppCreated = "app created",
51
+ AppDeleted = "app deleted",
52
+ RoleCreated = "role created",
53
+ RoleDeleted = "role deleted",
54
+ ApiResourceCreated = "api resource created",
55
+ ApiResourceDeleted = "api resource deleted",
56
+ OrganizationCreated = "organization created",
57
+ OrganizationDeleted = "organization deleted",
58
+ OrganizationRoleCreated = "organization role created",
59
+ OrganizationRoleDeleted = "organization role deleted",
60
+ SsoConnectorCreated = "sso connector created",
61
+ SsoConnectorDeleted = "sso connector deleted",
62
+ PasswordlessConnectorUpdated = "passwordless connector updated",
63
+ SocialConnectorCreated = "connector created",
64
+ SocialConnectorDeleted = "connector deleted",
65
+ WebhookCreated = "webhook created",
66
+ WebhookDeleted = "webhook deleted",
67
+ CustomJwtDeployed = "custom jwt deployed",
68
+ MfaEnabled = "mfa enabled",
69
+ MfaDisabled = "mfa disabled",
70
+ CustomDomainCreated = "custom domain created",
71
+ CustomDomainDeleted = "custom domain deleted"
72
+ }
73
+ /** The PostHog groups for product events. */
74
+ export declare enum EventGroup {
75
+ Tenant = "tenant"
76
+ }
77
+ /**
78
+ * The static distinct ID for tenant-level events. This is used when the event is not
79
+ * associated with a specific user.
80
+ *
81
+ * @see {@link https://posthog.com/docs/product-analytics/group-analytics#advanced-server-side-only-capturing-group-events-without-a-user}
82
+ */
83
+ export declare const tenantEventDistinctId = "TENANT_EVENT";
84
+ /**
85
+ * The header that carries the cloud user ID in a request from Logto Cloud. This is useful for
86
+ * identifying the user who initiated the Management API request proxied by the cloud service.
87
+ */
88
+ export declare const cloudUserIdHeader = "logto-cloud-user-id";
89
+ /**
90
+ * The types of access tokens issued by Logto.
91
+ *
92
+ * Note that this is for internal use only and is different from other technical definitions of
93
+ * token types.
94
+ */
95
+ export declare enum ProductAccessTokenType {
96
+ Unknown = "unknown",
97
+ User = "user",
98
+ ClientCredentials = "client_credentials"
99
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The product events that Logto Cloud uses for analytics and auditing.
3
+ *
4
+ * - All events should be in past tense, with the format of `<noun> <verb>`.
5
+ * - Unless otherwise specified, all events should contain tenant ID as the
6
+ * `tenant` group distinct ID.
7
+ *
8
+ * @remarks
9
+ * Events that are tracked in the cloud service will be marked with `@cloud`.
10
+ */
11
+ export var ProductEvent;
12
+ (function (ProductEvent) {
13
+ /** @cloud */
14
+ ProductEvent["TenantCreated"] = "tenant created";
15
+ /** @cloud */
16
+ ProductEvent["TenantDeleted"] = "tenant deleted";
17
+ /**
18
+ * One or more collaborators have been invited to the Logto Cloud tenant.
19
+ *
20
+ * @cloud
21
+ */
22
+ ProductEvent["CollaboratorInvited"] = "collaborator invited";
23
+ /**
24
+ * The Logto Cloud tenant has subscribed to the Pro plan. It may be the first time subscribing,
25
+ * switching from the Free plan, or converting from a dev tenant, etc.
26
+ *
27
+ * @cloud
28
+ */
29
+ ProductEvent["ProPlanSubscribed"] = "pro plan subscribed";
30
+ /**
31
+ * The Logto Cloud tenant has canceled the Pro plan.
32
+ *
33
+ * @cloud
34
+ */
35
+ ProductEvent["ProPlanCanceled"] = "pro plan canceled";
36
+ /**
37
+ * The Logto Cloud tenant has subscribed to the Free plan. This may happen when a tenant
38
+ * newly created or downgrading from the Pro plan.
39
+ *
40
+ * @cloud
41
+ */
42
+ ProductEvent["FreePlanSubscribed"] = "free plan subscribed";
43
+ /**
44
+ * A user has been created in the admin tenant. Interactive and non-interactive creations are
45
+ * both included.
46
+ */
47
+ ProductEvent["DeveloperCreated"] = "developer created";
48
+ /** A user has been deleted in the admin tenant. */
49
+ ProductEvent["DeveloperDeleted"] = "developer deleted";
50
+ ProductEvent["AccessTokenIssued"] = "access token issued";
51
+ ProductEvent["AppCreated"] = "app created";
52
+ ProductEvent["AppDeleted"] = "app deleted";
53
+ ProductEvent["RoleCreated"] = "role created";
54
+ ProductEvent["RoleDeleted"] = "role deleted";
55
+ ProductEvent["ApiResourceCreated"] = "api resource created";
56
+ ProductEvent["ApiResourceDeleted"] = "api resource deleted";
57
+ ProductEvent["OrganizationCreated"] = "organization created";
58
+ ProductEvent["OrganizationDeleted"] = "organization deleted";
59
+ ProductEvent["OrganizationRoleCreated"] = "organization role created";
60
+ ProductEvent["OrganizationRoleDeleted"] = "organization role deleted";
61
+ ProductEvent["SsoConnectorCreated"] = "sso connector created";
62
+ ProductEvent["SsoConnectorDeleted"] = "sso connector deleted";
63
+ ProductEvent["PasswordlessConnectorUpdated"] = "passwordless connector updated";
64
+ ProductEvent["SocialConnectorCreated"] = "connector created";
65
+ ProductEvent["SocialConnectorDeleted"] = "connector deleted";
66
+ ProductEvent["WebhookCreated"] = "webhook created";
67
+ ProductEvent["WebhookDeleted"] = "webhook deleted";
68
+ ProductEvent["CustomJwtDeployed"] = "custom jwt deployed";
69
+ ProductEvent["MfaEnabled"] = "mfa enabled";
70
+ ProductEvent["MfaDisabled"] = "mfa disabled";
71
+ ProductEvent["CustomDomainCreated"] = "custom domain created";
72
+ ProductEvent["CustomDomainDeleted"] = "custom domain deleted";
73
+ })(ProductEvent || (ProductEvent = {}));
74
+ /** The PostHog groups for product events. */
75
+ export var EventGroup;
76
+ (function (EventGroup) {
77
+ EventGroup["Tenant"] = "tenant";
78
+ })(EventGroup || (EventGroup = {}));
79
+ /**
80
+ * The static distinct ID for tenant-level events. This is used when the event is not
81
+ * associated with a specific user.
82
+ *
83
+ * @see {@link https://posthog.com/docs/product-analytics/group-analytics#advanced-server-side-only-capturing-group-events-without-a-user}
84
+ */
85
+ export const tenantEventDistinctId = 'TENANT_EVENT';
86
+ /**
87
+ * The header that carries the cloud user ID in a request from Logto Cloud. This is useful for
88
+ * identifying the user who initiated the Management API request proxied by the cloud service.
89
+ */
90
+ export const cloudUserIdHeader = 'logto-cloud-user-id';
91
+ /**
92
+ * The types of access tokens issued by Logto.
93
+ *
94
+ * Note that this is for internal use only and is different from other technical definitions of
95
+ * token types.
96
+ */
97
+ export var ProductAccessTokenType;
98
+ (function (ProductAccessTokenType) {
99
+ ProductAccessTokenType["Unknown"] = "unknown";
100
+ ProductAccessTokenType["User"] = "user";
101
+ ProductAccessTokenType["ClientCredentials"] = "client_credentials";
102
+ })(ProductAccessTokenType || (ProductAccessTokenType = {}));
@@ -10,6 +10,7 @@ export type CreateSignInExperience = {
10
10
  id: string;
11
11
  color: Color;
12
12
  branding: Branding;
13
+ hideLogtoBranding?: boolean;
13
14
  languageInfo: LanguageInfo;
14
15
  termsOfUseUrl?: string | null;
15
16
  privacyPolicyUrl?: string | null;
@@ -39,6 +40,7 @@ export type SignInExperience = {
39
40
  id: string;
40
41
  color: Color;
41
42
  branding: Branding;
43
+ hideLogtoBranding: boolean;
42
44
  languageInfo: LanguageInfo;
43
45
  termsOfUseUrl: string | null;
44
46
  privacyPolicyUrl: string | null;
@@ -63,5 +65,5 @@ export type SignInExperience = {
63
65
  emailBlocklistPolicy: EmailBlocklistPolicy;
64
66
  forgotPasswordMethods: ForgotPasswordMethods | null;
65
67
  };
66
- export type SignInExperienceKeys = 'tenantId' | 'id' | 'color' | 'branding' | 'languageInfo' | 'termsOfUseUrl' | 'privacyPolicyUrl' | 'agreeToTermsPolicy' | 'signIn' | 'signUp' | 'socialSignIn' | 'socialSignInConnectorTargets' | 'signInMode' | 'customCss' | 'customContent' | 'customUiAssets' | 'passwordPolicy' | 'mfa' | 'singleSignOnEnabled' | 'supportEmail' | 'supportWebsiteUrl' | 'unknownSessionRedirectUrl' | 'captchaPolicy' | 'sentinelPolicy' | 'emailBlocklistPolicy' | 'forgotPasswordMethods';
68
+ export type SignInExperienceKeys = 'tenantId' | 'id' | 'color' | 'branding' | 'hideLogtoBranding' | 'languageInfo' | 'termsOfUseUrl' | 'privacyPolicyUrl' | 'agreeToTermsPolicy' | 'signIn' | 'signUp' | 'socialSignIn' | 'socialSignInConnectorTargets' | 'signInMode' | 'customCss' | 'customContent' | 'customUiAssets' | 'passwordPolicy' | 'mfa' | 'singleSignOnEnabled' | 'supportEmail' | 'supportWebsiteUrl' | 'unknownSessionRedirectUrl' | 'captchaPolicy' | 'sentinelPolicy' | 'emailBlocklistPolicy' | 'forgotPasswordMethods';
67
69
  export declare const SignInExperiences: GeneratedSchema<SignInExperienceKeys, CreateSignInExperience, SignInExperience, 'sign_in_experiences', 'sign_in_experience'>;
@@ -7,6 +7,7 @@ const createGuard = z.object({
7
7
  id: z.string().min(1).max(21),
8
8
  color: colorGuard,
9
9
  branding: brandingGuard,
10
+ hideLogtoBranding: z.boolean().optional(),
10
11
  languageInfo: languageInfoGuard,
11
12
  termsOfUseUrl: z.string().max(2048).nullable().optional(),
12
13
  privacyPolicyUrl: z.string().max(2048).nullable().optional(),
@@ -35,6 +36,7 @@ const guard = z.object({
35
36
  id: z.string().min(1).max(21),
36
37
  color: colorGuard,
37
38
  branding: brandingGuard,
39
+ hideLogtoBranding: z.boolean(),
38
40
  languageInfo: languageInfoGuard,
39
41
  termsOfUseUrl: z.string().max(2048).nullable(),
40
42
  privacyPolicyUrl: z.string().max(2048).nullable(),
@@ -66,6 +68,7 @@ export const SignInExperiences = Object.freeze({
66
68
  id: 'id',
67
69
  color: 'color',
68
70
  branding: 'branding',
71
+ hideLogtoBranding: 'hide_logto_branding',
69
72
  languageInfo: 'language_info',
70
73
  termsOfUseUrl: 'terms_of_use_url',
71
74
  privacyPolicyUrl: 'privacy_policy_url',
@@ -94,6 +97,7 @@ export const SignInExperiences = Object.freeze({
94
97
  'id',
95
98
  'color',
96
99
  'branding',
100
+ 'hideLogtoBranding',
97
101
  'languageInfo',
98
102
  'termsOfUseUrl',
99
103
  'privacyPolicyUrl',
@@ -15,6 +15,7 @@ export const createDefaultSignInExperience = (forTenantId, isCloud) => Object.fr
15
15
  logoUrl: isCloud ? undefined : 'https://logto.io/logo.svg',
16
16
  darkLogoUrl: isCloud ? undefined : 'https://logto.io/logo-dark.svg',
17
17
  },
18
+ hideLogtoBranding: false,
18
19
  languageInfo: {
19
20
  autoDetect: true,
20
21
  fallbackLanguage: 'en',
@@ -58,6 +58,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
58
58
  favicon?: string | undefined;
59
59
  darkFavicon?: string | undefined;
60
60
  }>;
61
+ hideLogtoBranding: z.ZodType<boolean, z.ZodTypeDef, boolean>;
61
62
  languageInfo: z.ZodType<{
62
63
  autoDetect: boolean;
63
64
  fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
@@ -690,6 +691,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
690
691
  customCss: string | null;
691
692
  termsOfUseUrl: string | null;
692
693
  privacyPolicyUrl: string | null;
694
+ hideLogtoBranding: boolean;
693
695
  languageInfo: import("../foundations/jsonb-types/sign-in-experience.js").LanguageInfo;
694
696
  agreeToTermsPolicy: import("../db-entries/custom-types.js").AgreeToTermsPolicy;
695
697
  signIn: import("../foundations/jsonb-types/sign-in-experience.js").SignIn;
@@ -881,6 +883,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
881
883
  customCss: string | null;
882
884
  termsOfUseUrl: string | null;
883
885
  privacyPolicyUrl: string | null;
886
+ hideLogtoBranding: boolean;
884
887
  languageInfo: import("../foundations/jsonb-types/sign-in-experience.js").LanguageInfo;
885
888
  agreeToTermsPolicy: import("../db-entries/custom-types.js").AgreeToTermsPolicy;
886
889
  signIn: import("../foundations/jsonb-types/sign-in-experience.js").SignIn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/schemas",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "author": "Silverhand Inc. <contact@silverhand.io>",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -65,12 +65,12 @@
65
65
  "dependencies": {
66
66
  "@withtyped/server": "^0.14.0",
67
67
  "nanoid": "^5.0.9",
68
+ "@logto/language-kit": "^1.2.0",
68
69
  "@logto/core-kit": "^2.6.1",
69
70
  "@logto/connector-kit": "^4.6.0",
71
+ "@logto/phrases": "^1.22.0",
70
72
  "@logto/phrases-experience": "^1.12.0",
71
- "@logto/phrases": "^1.21.0",
72
- "@logto/shared": "^3.3.0",
73
- "@logto/language-kit": "^1.2.0"
73
+ "@logto/shared": "^3.3.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "zod": "3.24.3"
@@ -26,6 +26,9 @@ create index applications__id
26
26
  create index applications__is_third_party
27
27
  on applications (tenant_id, is_third_party);
28
28
 
29
+ create index applications__type
30
+ on applications (tenant_id, type);
31
+
29
32
  create unique index applications__protected_app_metadata_host
30
33
  on applications (
31
34
  (protected_app_metadata->>'host')
package/tables/roles.sql CHANGED
@@ -19,6 +19,9 @@ create table roles (
19
19
  create index roles__id
20
20
  on roles (tenant_id, id);
21
21
 
22
+ create index roles__type
23
+ on roles (tenant_id, type);
24
+
22
25
  create function public.check_role_type(role_id varchar(21), target_type role_type) returns boolean as
23
26
  $$ begin
24
27
  return (select type from public.roles where id = role_id) = target_type;
@@ -7,6 +7,7 @@ create table sign_in_experiences (
7
7
  id varchar(21) not null,
8
8
  color jsonb /* @use Color */ not null,
9
9
  branding jsonb /* @use Branding */ not null,
10
+ hide_logto_branding boolean not null default false,
10
11
  language_info jsonb /* @use LanguageInfo */ not null,
11
12
  terms_of_use_url varchar(2048),
12
13
  privacy_policy_url varchar(2048),