@famgia/omnify-react-sso 2.2.1 → 2.2.3

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.
@@ -14,14 +14,14 @@ import type { DateTimeString } from './common';
14
14
  import type { Role } from './Role';
15
15
 
16
16
  /**
17
- * User
17
+ * ユーザー
18
18
  */
19
19
  export interface User {
20
20
  /** Primary key */
21
21
  id: string;
22
- /** Name */
22
+ /** 名前 */
23
23
  name: string;
24
- /** Email */
24
+ /** メールアドレス */
25
25
  email: string;
26
26
  /** Console User ID */
27
27
  console_user_id?: unknown;
@@ -29,9 +29,9 @@ export interface User {
29
29
  console_access_token?: string;
30
30
  /** Console Refresh Token */
31
31
  console_refresh_token?: string;
32
- /** Console Token Expiry */
32
+ /** Console Token有効期限 */
33
33
  console_token_expires_at?: DateTimeString;
34
- /** Roles */
34
+ /** ロール */
35
35
  roles: Role[];
36
36
  /** Creation timestamp */
37
37
  created_at?: DateTimeString;
@@ -49,29 +49,29 @@ export interface User {
49
49
  */
50
50
  export const userI18n = {
51
51
  /** Model display name */
52
- label: {"en":"User"},
52
+ label: {"ja":"ユーザー","en":"User"},
53
53
  /** Field labels and placeholders */
54
54
  fields: {
55
55
  name: {
56
- label: {"en":"Name"},
56
+ label: {"ja":"名前","en":"Name"},
57
57
  },
58
58
  email: {
59
- label: {"en":"Email"},
59
+ label: {"ja":"メールアドレス","en":"Email"},
60
60
  },
61
61
  console_user_id: {
62
- label: {"en":"Console User ID"},
62
+ label: {"ja":"Console User ID","en":"Console User ID"},
63
63
  },
64
64
  console_access_token: {
65
- label: {"en":"Console Access Token"},
65
+ label: {"ja":"Console Access Token","en":"Console Access Token"},
66
66
  },
67
67
  console_refresh_token: {
68
- label: {"en":"Console Refresh Token"},
68
+ label: {"ja":"Console Refresh Token","en":"Console Refresh Token"},
69
69
  },
70
70
  console_token_expires_at: {
71
- label: {"en":"Console Token Expiry"},
71
+ label: {"ja":"Console Token有効期限","en":"Console Token Expiry"},
72
72
  },
73
73
  roles: {
74
- label: {"en":"Roles"},
74
+ label: {"ja":"ロール","en":"Roles"},
75
75
  },
76
76
  },
77
77
  } as const;
@@ -0,0 +1,142 @@
1
+ /**
2
+ * ⚠️ DO NOT EDIT THIS FILE! ⚠️
3
+ * このファイルを編集しないでください!
4
+ * KHÔNG ĐƯỢC SỬA FILE NÀY!
5
+ *
6
+ * Auto-generated TypeScript types from Omnify schemas.
7
+ * Any manual changes will be OVERWRITTEN on next generation.
8
+ *
9
+ * To modify: Edit the schema YAML file and run: npx omnify generate
10
+ */
11
+
12
+ import { z } from 'zod';
13
+ import type { DateTimeString } from './common';
14
+ import type { Role } from './Role';
15
+
16
+ /**
17
+ * ユーザーキャッシュ
18
+ */
19
+ export interface UserCache {
20
+ /** Primary key */
21
+ id: string;
22
+ /** 名前 */
23
+ name: string;
24
+ /** メールアドレス */
25
+ email: string;
26
+ /** Console User ID */
27
+ console_user_id?: unknown;
28
+ /** 所属組織ID */
29
+ console_org_id?: unknown;
30
+ /** Console Access Token */
31
+ console_access_token?: string;
32
+ /** Console Refresh Token */
33
+ console_refresh_token?: string;
34
+ /** Console Token有効期限 */
35
+ console_token_expires_at?: DateTimeString;
36
+ /** ロール */
37
+ roles: Role[];
38
+ /** Creation timestamp */
39
+ created_at?: DateTimeString;
40
+ /** Last update timestamp */
41
+ updated_at?: DateTimeString;
42
+ }
43
+
44
+ // ============================================================================
45
+ // I18n (Internationalization)
46
+ // ============================================================================
47
+
48
+ /**
49
+ * Unified i18n object for UserCache
50
+ * Contains model label and all field labels/placeholders
51
+ */
52
+ export const userCacheI18n = {
53
+ /** Model display name */
54
+ label: {"ja":"ユーザーキャッシュ","en":"User Cache"},
55
+ /** Field labels and placeholders */
56
+ fields: {
57
+ name: {
58
+ label: {"ja":"名前","en":"Name"},
59
+ },
60
+ email: {
61
+ label: {"ja":"メールアドレス","en":"Email"},
62
+ },
63
+ console_user_id: {
64
+ label: {"ja":"Console User ID","en":"Console User ID"},
65
+ },
66
+ console_org_id: {
67
+ label: {"ja":"所属組織ID","en":"Organization ID"},
68
+ },
69
+ console_access_token: {
70
+ label: {"ja":"Console Access Token","en":"Console Access Token"},
71
+ },
72
+ console_refresh_token: {
73
+ label: {"ja":"Console Refresh Token","en":"Console Refresh Token"},
74
+ },
75
+ console_token_expires_at: {
76
+ label: {"ja":"Console Token有効期限","en":"Console Token Expiry"},
77
+ },
78
+ roles: {
79
+ label: {"ja":"ロール","en":"Roles"},
80
+ },
81
+ },
82
+ } as const;
83
+
84
+ // ============================================================================
85
+ // Zod Schemas
86
+ // ============================================================================
87
+
88
+ /** Field schemas for UserCache */
89
+ export const baseUserCacheSchemas = {
90
+ name: z.string().min(1),
91
+ email: z.string().min(1),
92
+ console_user_id: z.string().optional().nullable(),
93
+ console_org_id: z.string().optional().nullable(),
94
+ console_access_token: z.string().optional().nullable(),
95
+ console_refresh_token: z.string().optional().nullable(),
96
+ console_token_expires_at: z.string().datetime({ offset: true }).optional().nullable(),
97
+ } as const;
98
+
99
+ /** Create schema for UserCache (POST requests) */
100
+ export const baseUserCacheCreateSchema = z.object({
101
+ name: baseUserCacheSchemas.name,
102
+ email: baseUserCacheSchemas.email,
103
+ console_user_id: baseUserCacheSchemas.console_user_id,
104
+ console_org_id: baseUserCacheSchemas.console_org_id,
105
+ console_access_token: baseUserCacheSchemas.console_access_token,
106
+ console_refresh_token: baseUserCacheSchemas.console_refresh_token,
107
+ console_token_expires_at: baseUserCacheSchemas.console_token_expires_at,
108
+ });
109
+
110
+ /** Update schema for UserCache (PUT/PATCH requests) */
111
+ export const baseUserCacheUpdateSchema = baseUserCacheCreateSchema.partial();
112
+
113
+ // ============================================================================
114
+ // Inferred Types
115
+ // ============================================================================
116
+
117
+ export type BaseUserCacheCreate = z.infer<typeof baseUserCacheCreateSchema>;
118
+ export type BaseUserCacheUpdate = z.infer<typeof baseUserCacheUpdateSchema>;
119
+
120
+ // ============================================================================
121
+ // I18n Helper Functions
122
+ // ============================================================================
123
+
124
+ /** Get model label for a specific locale */
125
+ export function getUserCacheLabel(locale: string): string {
126
+ return userCacheI18n.label[locale as keyof typeof userCacheI18n.label] ?? userCacheI18n.label['en'] ?? 'UserCache';
127
+ }
128
+
129
+ /** Get field label for a specific locale */
130
+ export function getUserCacheFieldLabel(field: string, locale: string): string {
131
+ const fieldI18n = userCacheI18n.fields[field as keyof typeof userCacheI18n.fields];
132
+ if (!fieldI18n) return field;
133
+ return fieldI18n.label[locale as keyof typeof fieldI18n.label] ?? fieldI18n.label['en'] ?? field;
134
+ }
135
+
136
+ /** Get field placeholder for a specific locale */
137
+ export function getUserCacheFieldPlaceholder(field: string, locale: string): string {
138
+ const fieldI18n = userCacheI18n.fields[field as keyof typeof userCacheI18n.fields];
139
+ if (!fieldI18n || !('placeholder' in fieldI18n)) return '';
140
+ const placeholder = fieldI18n.placeholder as Record<string, string>;
141
+ return placeholder[locale] ?? placeholder['en'] ?? '';
142
+ }