@xxmachina/common 19.51.0 → 19.81.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 (61) hide show
  1. package/fesm2022/xxmachina-common-_shared-ansi.mjs +0 -16
  2. package/fesm2022/xxmachina-common-_shared-ansi.mjs.map +1 -1
  3. package/fesm2022/xxmachina-common-_shared-meta-redis.mjs +0 -5
  4. package/fesm2022/xxmachina-common-_shared-meta-redis.mjs.map +1 -1
  5. package/fesm2022/xxmachina-common-_shared-meta.mjs +2 -3
  6. package/fesm2022/xxmachina-common-_shared-meta.mjs.map +1 -1
  7. package/fesm2022/xxmachina-common-auth-firebase.mjs +0 -4
  8. package/fesm2022/xxmachina-common-auth-firebase.mjs.map +1 -1
  9. package/fesm2022/xxmachina-common-domain-builder-screen-item.mjs +0 -15
  10. package/fesm2022/xxmachina-common-domain-builder-screen-item.mjs.map +1 -1
  11. package/fesm2022/xxmachina-common-domain-builder.mjs +1 -25
  12. package/fesm2022/xxmachina-common-domain-builder.mjs.map +1 -1
  13. package/fesm2022/xxmachina-common-domain-models.mjs +1 -19
  14. package/fesm2022/xxmachina-common-domain-models.mjs.map +1 -1
  15. package/fesm2022/xxmachina-common-infra-external-quick-js.mjs +0 -3
  16. package/fesm2022/xxmachina-common-infra-external-quick-js.mjs.map +1 -1
  17. package/fesm2022/xxmachina-common-infra-query-hasura.mjs +1 -0
  18. package/fesm2022/xxmachina-common-infra-query-hasura.mjs.map +1 -1
  19. package/fesm2022/xxmachina-common-infra.mjs +0 -19
  20. package/fesm2022/xxmachina-common-infra.mjs.map +1 -1
  21. package/fesm2022/xxmachina-common-invoice-domain-models.mjs +10 -1
  22. package/fesm2022/xxmachina-common-invoice-domain-models.mjs.map +1 -1
  23. package/fesm2022/xxmachina-common-invoice-usecase-invoice.mjs +0 -12
  24. package/fesm2022/xxmachina-common-invoice-usecase-invoice.mjs.map +1 -1
  25. package/fesm2022/xxmachina-common-invoice-usecase-order.mjs +0 -2
  26. package/fesm2022/xxmachina-common-invoice-usecase-order.mjs.map +1 -1
  27. package/fesm2022/xxmachina-common-invoice-usecase-partner.mjs +0 -2
  28. package/fesm2022/xxmachina-common-invoice-usecase-partner.mjs.map +1 -1
  29. package/fesm2022/xxmachina-common-services-device-profile.mjs +26 -0
  30. package/fesm2022/xxmachina-common-services-device-profile.mjs.map +1 -0
  31. package/fesm2022/xxmachina-common-services-graphql.mjs +1 -70
  32. package/fesm2022/xxmachina-common-services-graphql.mjs.map +1 -1
  33. package/fesm2022/xxmachina-common-services-speech.mjs +0 -17
  34. package/fesm2022/xxmachina-common-services-speech.mjs.map +1 -1
  35. package/fesm2022/xxmachina-common-usecase-database.mjs +0 -3
  36. package/fesm2022/xxmachina-common-usecase-database.mjs.map +1 -1
  37. package/fesm2022/xxmachina-common-usecase-graphql.mjs +0 -1
  38. package/fesm2022/xxmachina-common-usecase-graphql.mjs.map +1 -1
  39. package/fesm2022/xxmachina-common-usecase.mjs +0 -1
  40. package/fesm2022/xxmachina-common-usecase.mjs.map +1 -1
  41. package/fesm2022/xxmachina-common-utils.mjs +0 -8
  42. package/fesm2022/xxmachina-common-utils.mjs.map +1 -1
  43. package/package.json +15 -11
  44. package/types/xxmachina-common-_shared-ansi.d.ts +0 -15
  45. package/types/xxmachina-common-_shared-ansi.d.ts.map +1 -1
  46. package/types/xxmachina-common-auth-firebase.d.ts +0 -4
  47. package/types/xxmachina-common-auth-firebase.d.ts.map +1 -1
  48. package/types/xxmachina-common-domain-builder-screen-item.d.ts +0 -15
  49. package/types/xxmachina-common-domain-builder-screen-item.d.ts.map +1 -1
  50. package/types/xxmachina-common-domain-builder.d.ts +0 -21
  51. package/types/xxmachina-common-domain-builder.d.ts.map +1 -1
  52. package/types/xxmachina-common-domain-models-presenter.d.ts +0 -46
  53. package/types/xxmachina-common-domain-models-presenter.d.ts.map +1 -1
  54. package/types/xxmachina-common-domain-models.d.ts +0 -59
  55. package/types/xxmachina-common-domain-models.d.ts.map +1 -1
  56. package/types/xxmachina-common-invoice-domain-models.d.ts +6 -1
  57. package/types/xxmachina-common-invoice-domain-models.d.ts.map +1 -1
  58. package/types/xxmachina-common-services-device-profile.d.ts +13 -0
  59. package/types/xxmachina-common-services-device-profile.d.ts.map +1 -0
  60. package/types/xxmachina-common-services-graphql.d.ts +0 -40
  61. package/types/xxmachina-common-services-graphql.d.ts.map +1 -1
@@ -5,9 +5,6 @@ import { interval, filter } from 'rxjs';
5
5
 
6
6
  // eslint-disable-next-line @typescript-eslint/triple-slash-reference
7
7
  /// <reference path="./speech-recognition.d.ts" />
8
- /**
9
- * SpeechRecognition APIの初期化
10
- */
11
8
  function initializeSpeechRecognitionAPI() {
12
9
  if (typeof window === 'undefined')
13
10
  return null;
@@ -22,10 +19,6 @@ function initializeSpeechRecognitionAPI() {
22
19
  recognition.lang = 'ja-JP';
23
20
  return recognition;
24
21
  }
25
- /**
26
- * SpeechRecognitionイベントをパースして中間結果と確定結果を返す
27
- * @param startIndex - 読み取り開始インデックス(指定時はevent.resultIndexより優先)
28
- */
29
22
  function parseSpeechRecognitionEvent(event, startIndex) {
30
23
  const from = startIndex ?? event.resultIndex;
31
24
  const results = [];
@@ -60,9 +53,7 @@ class SpeechService {
60
53
  (('SpeechRecognition' in window) || ('webkitSpeechRecognition' in window));
61
54
  finalized = computed(() => this.transcript().finalized, ...(ngDevMode ? [{ debugName: "finalized" }] : []));
62
55
  finalized$ = toObservable(this.finalized);
63
- // 自動モード: セッション選択時に自動的に音声入力を開始
64
56
  autoModeEnabled = signal(false, ...(ngDevMode ? [{ debugName: "autoModeEnabled" }] : []));
65
- // 選択中のセッションID(自動音声入力制御用)
66
57
  selectedSessionId = signal(null, ...(ngDevMode ? [{ debugName: "selectedSessionId" }] : []));
67
58
  constructor() {
68
59
  interval(this.PAUSE_THRESHOLD).pipe(filter(() => this.isListening() && (Date.now() - this.lastSpeechTime()) >= this.PAUSE_THRESHOLD)).subscribe(() => {
@@ -109,11 +100,9 @@ class SpeechService {
109
100
  clear() {
110
101
  this.transcript.set({ interim: '', finalized: '' });
111
102
  if (this.autoModeEnabled() && this.recognition && this.isListening()) {
112
- // Auto mode: Speech APIを止めない。result indexで古い結果をフィルタ
113
103
  this.resultIndexThreshold = this.lastKnownResultsLength;
114
104
  return;
115
105
  }
116
- // Non-auto mode: stop → onend → restart で確実にリセット
117
106
  this.ignoreResults = true;
118
107
  if (this.recognition && this.isListening()) {
119
108
  try {
@@ -124,11 +113,9 @@ class SpeechService {
124
113
  }
125
114
  }
126
115
  }
127
- // 自動モードのトグル
128
116
  toggleAutoMode(enabled) {
129
117
  this.autoModeEnabled.set(enabled);
130
118
  if (enabled) {
131
- // 自動モードON → セッション選択済みならSpeech API有効化
132
119
  if (this.selectedSessionId()) {
133
120
  this.isListening.set(true);
134
121
  this.startRecognition();
@@ -138,7 +125,6 @@ class SpeechService {
138
125
  this.stop();
139
126
  }
140
127
  }
141
- // セッション選択時の自動音声入力制御(Speech APIは止めない)
142
128
  selectSession(sessionId) {
143
129
  const prevId = this.selectedSessionId();
144
130
  this.selectedSessionId.set(sessionId);
@@ -148,12 +134,10 @@ class SpeechService {
148
134
  this.stop();
149
135
  return;
150
136
  }
151
- // セッション切り替え時: 前のテキストを確定→書き込み先は各コンポーネントが切り替える
152
137
  if (prevId && prevId !== sessionId) {
153
138
  this.finalizeCurrentTranscript();
154
139
  }
155
140
  }
156
- // 書き込み先の切り替え専用(Speech APIは触らない)
157
141
  activateComponent(componentId) {
158
142
  if (this.activeComponentId() === componentId)
159
143
  return;
@@ -176,7 +160,6 @@ class SpeechService {
176
160
  if (this.ignoreResults)
177
161
  return;
178
162
  this.lastKnownResultsLength = event.results.length;
179
- // auto mode clear後: threshold未満のresultをスキップ
180
163
  const startIndex = Math.max(event.resultIndex, this.resultIndexThreshold);
181
164
  if (startIndex >= event.results.length)
182
165
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-services-speech.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/services/speech/speech-recognition-utils.ts","../../../../../packages/@xxmachina/common/src/lib/services/speech/speech.service.ts","../../../../../packages/@xxmachina/common/src/lib/services/speech/xxmachina-common-services-speech.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./speech-recognition.d.ts\" />\n\n/**\n * SpeechRecognition APIの初期化\n */\nexport function initializeSpeechRecognitionAPI(): SpeechRecognition | null {\n if (typeof window === 'undefined') return null;\n if (!('SpeechRecognition' in window) && !('webkitSpeechRecognition' in window)) {\n console.warn('[SpeechService] SpeechRecognition API is not supported in this browser');\n return null;\n }\n\n const SpeechRecognitionAPI = (window as any).SpeechRecognition || (window as any).webkitSpeechRecognition;\n const recognition = new SpeechRecognitionAPI();\n recognition.continuous = true;\n recognition.interimResults = true;\n recognition.lang = 'ja-JP';\n return recognition;\n}\n\n/**\n * SpeechRecognitionイベントをパースして中間結果と確定結果を返す\n * @param startIndex - 読み取り開始インデックス(指定時はevent.resultIndexより優先)\n */\nexport function parseSpeechRecognitionEvent(\n event: SpeechRecognitionEvent,\n startIndex?: number,\n): { interim: string; finalized: string } {\n const from = startIndex ?? event.resultIndex;\n const results: SpeechRecognitionAlternative[] = [];\n for (let i = from; i < event.results.length; i++) {\n results.push({\n transcript: event.results[i][0].transcript,\n confidence: event.results[i][0].confidence,\n isFinal: event.results[i].isFinal,\n } as any);\n }\n return {\n interim: results.filter((result: any) => !result.isFinal).map((result) => result.transcript).join(''),\n finalized: results.filter((result: any) => result.isFinal).map((result) => result.transcript).join(''),\n };\n}\n","// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./speech-recognition.d.ts\" />\nimport { Injectable, signal, effect, computed } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { filter, interval } from 'rxjs';\nimport { initializeSpeechRecognitionAPI, parseSpeechRecognitionEvent } from './speech-recognition-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SpeechService {\n private static instanceCounter = 0;\n private readonly PAUSE_THRESHOLD = 1000;\n private recognition: SpeechRecognition | null = null;\n private lastSpeechTime = signal(Date.now());\n private ignoreResults = false;\n private lastKnownResultsLength = 0;\n private resultIndexThreshold = 0;\n\n readonly transcript = signal<{ finalized: string; interim: string }>({ finalized: '', interim: '' });\n readonly transcript$ = toObservable(this.transcript);\n readonly isListening = signal(false);\n readonly activeComponentId = signal<string | null>(null);\n readonly isSupported = typeof window !== 'undefined' &&\n (('SpeechRecognition' in window) || ('webkitSpeechRecognition' in window));\n\n readonly finalized = computed(() => this.transcript().finalized);\n readonly finalized$ = toObservable(this.finalized);\n\n // 自動モード: セッション選択時に自動的に音声入力を開始\n readonly autoModeEnabled = signal(false);\n // 選択中のセッションID(自動音声入力制御用)\n readonly selectedSessionId = signal<string | null>(null);\n\n constructor() {\n interval(this.PAUSE_THRESHOLD).pipe(\n filter(() => this.isListening() && (Date.now() - this.lastSpeechTime()) >= this.PAUSE_THRESHOLD),\n ).subscribe(() => {\n this.transcript.update(current => ({\n interim: '',\n finalized: current.finalized + (current.interim || '')\n }));\n });\n\n effect(() => {\n if (!this.isListening()) {\n this.stopRecognition();\n }\n });\n }\n\n generateComponentId(): string {\n return `speech-${++SpeechService.instanceCounter}`;\n }\n\n isActiveComponent(componentId: string): boolean {\n return this.activeComponentId() === componentId;\n }\n\n start(componentId: string): void {\n if (!this.isSupported) {\n console.warn('[SpeechService] Speech recognition is not supported');\n return;\n }\n this.stopRecognition();\n this.activeComponentId.set(componentId);\n this.transcript.set({ interim: '', finalized: '' });\n this.isListening.set(true);\n this.startRecognition();\n }\n\n stop(): void {\n this.isListening.set(false);\n this.activeComponentId.set(null);\n }\n\n toggle(componentId: string): void {\n if (this.isActiveComponent(componentId) && this.isListening()) {\n this.stop();\n } else {\n this.start(componentId);\n }\n }\n\n clear(): void {\n this.transcript.set({ interim: '', finalized: '' });\n\n if (this.autoModeEnabled() && this.recognition && this.isListening()) {\n // Auto mode: Speech APIを止めない。result indexで古い結果をフィルタ\n this.resultIndexThreshold = this.lastKnownResultsLength;\n return;\n }\n\n // Non-auto mode: stop → onend → restart で確実にリセット\n this.ignoreResults = true;\n if (this.recognition && this.isListening()) {\n try {\n this.recognition.stop();\n } catch (error) {\n console.error('[SpeechService] Error restarting recognition:', error);\n }\n }\n }\n\n // 自動モードのトグル\n toggleAutoMode(enabled: boolean): void {\n this.autoModeEnabled.set(enabled);\n if (enabled) {\n // 自動モードON → セッション選択済みならSpeech API有効化\n if (this.selectedSessionId()) {\n this.isListening.set(true);\n this.startRecognition();\n }\n } else {\n this.stop();\n }\n }\n\n // セッション選択時の自動音声入力制御(Speech APIは止めない)\n selectSession(sessionId: string | null): void {\n const prevId = this.selectedSessionId();\n this.selectedSessionId.set(sessionId);\n if (!this.autoModeEnabled()) return;\n\n if (!sessionId) {\n this.stop();\n return;\n }\n\n // セッション切り替え時: 前のテキストを確定→書き込み先は各コンポーネントが切り替える\n if (prevId && prevId !== sessionId) {\n this.finalizeCurrentTranscript();\n }\n }\n\n // 書き込み先の切り替え専用(Speech APIは触らない)\n activateComponent(componentId: string): void {\n if (this.activeComponentId() === componentId) return;\n this.activeComponentId.set(componentId);\n this.transcript.set({ interim: '', finalized: '' });\n }\n\n private finalizeCurrentTranscript(): void {\n this.transcript.update(current => ({\n interim: '',\n finalized: current.finalized + (current.interim || '')\n }));\n }\n\n private setupRecognition(): void {\n if (!this.isSupported) return;\n\n this.recognition = initializeSpeechRecognitionAPI();\n if (!this.recognition) return;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n if (this.ignoreResults) return;\n this.lastKnownResultsLength = event.results.length;\n\n // auto mode clear後: threshold未満のresultをスキップ\n const startIndex = Math.max(event.resultIndex, this.resultIndexThreshold);\n if (startIndex >= event.results.length) return;\n\n const { interim, finalized } = parseSpeechRecognitionEvent(event, startIndex);\n this.transcript.update((current) => ({\n interim,\n finalized: finalized.length ? `${current.finalized}${finalized}` : current.finalized\n }));\n this.lastSpeechTime.set(Date.now());\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n console.error('[SpeechService] Recognition error:', event.error);\n if (event.error === 'not-allowed') {\n this.stop();\n }\n };\n\n this.recognition.onend = () => {\n if (this.isListening()) {\n this.startRecognition();\n }\n };\n }\n\n private startRecognition(): void {\n this.ignoreResults = false;\n this.resultIndexThreshold = 0;\n this.lastKnownResultsLength = 0;\n if (!this.recognition) {\n this.setupRecognition();\n }\n\n try {\n this.recognition?.start();\n } catch (error) {\n console.error('[SpeechService] Failed to start recognition:', error);\n this.recognition = null;\n this.setupRecognition();\n (this.recognition as SpeechRecognition | null)?.start();\n }\n }\n\n private stopRecognition(): void {\n if (this.recognition) {\n this.recognition.onend = null;\n this.recognition.onresult = null;\n this.recognition.onerror = null;\n try {\n this.recognition.stop();\n } catch (error) {\n console.error('[SpeechService] Error stopping recognition:', error);\n }\n this.recognition = null;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAEA;;AAEG;SACa,8BAA8B,GAAA;IAC5C,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,IAAI;AAC9C,IAAA,IAAI,EAAE,mBAAmB,IAAI,MAAM,CAAC,IAAI,EAAE,yBAAyB,IAAI,MAAM,CAAC,EAAE;AAC9E,QAAA,OAAO,CAAC,IAAI,CAAC,wEAAwE,CAAC;AACtF,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,oBAAoB,GAAI,MAAc,CAAC,iBAAiB,IAAK,MAAc,CAAC,uBAAuB;AACzG,IAAA,MAAM,WAAW,GAAG,IAAI,oBAAoB,EAAE;AAC9C,IAAA,WAAW,CAAC,UAAU,GAAG,IAAI;AAC7B,IAAA,WAAW,CAAC,cAAc,GAAG,IAAI;AACjC,IAAA,WAAW,CAAC,IAAI,GAAG,OAAO;AAC1B,IAAA,OAAO,WAAW;AACpB;AAEA;;;AAGG;AACG,SAAU,2BAA2B,CACzC,KAA6B,EAC7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K,CAAC,6CAA6C,EAAE,KAAK,CAAC;YACrE;AACA,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI;QACzB;IACF;uGA7MW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA;;2FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACPlC;;AAEG;;;;"}
1
+ {"version":3,"file":"xxmachina-common-services-speech.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/services/speech/speech-recognition-utils.ts","../../../../../packages/@xxmachina/common/src/lib/services/speech/speech.service.ts","../../../../../packages/@xxmachina/common/src/lib/services/speech/xxmachina-common-services-speech.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./speech-recognition.d.ts\" />\n\n\nexport function initializeSpeechRecognitionAPI(): SpeechRecognition | null {\n if (typeof window === 'undefined') return null;\n if (!('SpeechRecognition' in window) && !('webkitSpeechRecognition' in window)) {\n console.warn('[SpeechService] SpeechRecognition API is not supported in this browser');\n return null;\n }\n\n const SpeechRecognitionAPI = (window as any).SpeechRecognition || (window as any).webkitSpeechRecognition;\n const recognition = new SpeechRecognitionAPI();\n recognition.continuous = true;\n recognition.interimResults = true;\n recognition.lang = 'ja-JP';\n return recognition;\n}\n\n\nexport function parseSpeechRecognitionEvent(\n event: SpeechRecognitionEvent,\n startIndex?: number,\n): { interim: string; finalized: string } {\n const from = startIndex ?? event.resultIndex;\n const results: SpeechRecognitionAlternative[] = [];\n for (let i = from; i < event.results.length; i++) {\n results.push({\n transcript: event.results[i][0].transcript,\n confidence: event.results[i][0].confidence,\n isFinal: event.results[i].isFinal,\n } as any);\n }\n return {\n interim: results.filter((result: any) => !result.isFinal).map((result) => result.transcript).join(''),\n finalized: results.filter((result: any) => result.isFinal).map((result) => result.transcript).join(''),\n };\n}\n","// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./speech-recognition.d.ts\" />\nimport { Injectable, signal, effect, computed } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { filter, interval } from 'rxjs';\nimport { initializeSpeechRecognitionAPI, parseSpeechRecognitionEvent } from './speech-recognition-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SpeechService {\n private static instanceCounter = 0;\n private readonly PAUSE_THRESHOLD = 1000;\n private recognition: SpeechRecognition | null = null;\n private lastSpeechTime = signal(Date.now());\n private ignoreResults = false;\n private lastKnownResultsLength = 0;\n private resultIndexThreshold = 0;\n\n readonly transcript = signal<{ finalized: string; interim: string }>({ finalized: '', interim: '' });\n readonly transcript$ = toObservable(this.transcript);\n readonly isListening = signal(false);\n readonly activeComponentId = signal<string | null>(null);\n readonly isSupported = typeof window !== 'undefined' &&\n (('SpeechRecognition' in window) || ('webkitSpeechRecognition' in window));\n\n readonly finalized = computed(() => this.transcript().finalized);\n readonly finalized$ = toObservable(this.finalized);\n\n \n readonly autoModeEnabled = signal(false);\n \n readonly selectedSessionId = signal<string | null>(null);\n\n constructor() {\n interval(this.PAUSE_THRESHOLD).pipe(\n filter(() => this.isListening() && (Date.now() - this.lastSpeechTime()) >= this.PAUSE_THRESHOLD),\n ).subscribe(() => {\n this.transcript.update(current => ({\n interim: '',\n finalized: current.finalized + (current.interim || '')\n }));\n });\n\n effect(() => {\n if (!this.isListening()) {\n this.stopRecognition();\n }\n });\n }\n\n generateComponentId(): string {\n return `speech-${++SpeechService.instanceCounter}`;\n }\n\n isActiveComponent(componentId: string): boolean {\n return this.activeComponentId() === componentId;\n }\n\n start(componentId: string): void {\n if (!this.isSupported) {\n console.warn('[SpeechService] Speech recognition is not supported');\n return;\n }\n this.stopRecognition();\n this.activeComponentId.set(componentId);\n this.transcript.set({ interim: '', finalized: '' });\n this.isListening.set(true);\n this.startRecognition();\n }\n\n stop(): void {\n this.isListening.set(false);\n this.activeComponentId.set(null);\n }\n\n toggle(componentId: string): void {\n if (this.isActiveComponent(componentId) && this.isListening()) {\n this.stop();\n } else {\n this.start(componentId);\n }\n }\n\n clear(): void {\n this.transcript.set({ interim: '', finalized: '' });\n\n if (this.autoModeEnabled() && this.recognition && this.isListening()) {\n \n this.resultIndexThreshold = this.lastKnownResultsLength;\n return;\n }\n\n \n this.ignoreResults = true;\n if (this.recognition && this.isListening()) {\n try {\n this.recognition.stop();\n } catch (error) {\n console.error('[SpeechService] Error restarting recognition:', error);\n }\n }\n }\n\n \n toggleAutoMode(enabled: boolean): void {\n this.autoModeEnabled.set(enabled);\n if (enabled) {\n \n if (this.selectedSessionId()) {\n this.isListening.set(true);\n this.startRecognition();\n }\n } else {\n this.stop();\n }\n }\n\n \n selectSession(sessionId: string | null): void {\n const prevId = this.selectedSessionId();\n this.selectedSessionId.set(sessionId);\n if (!this.autoModeEnabled()) return;\n\n if (!sessionId) {\n this.stop();\n return;\n }\n\n \n if (prevId && prevId !== sessionId) {\n this.finalizeCurrentTranscript();\n }\n }\n\n \n activateComponent(componentId: string): void {\n if (this.activeComponentId() === componentId) return;\n this.activeComponentId.set(componentId);\n this.transcript.set({ interim: '', finalized: '' });\n }\n\n private finalizeCurrentTranscript(): void {\n this.transcript.update(current => ({\n interim: '',\n finalized: current.finalized + (current.interim || '')\n }));\n }\n\n private setupRecognition(): void {\n if (!this.isSupported) return;\n\n this.recognition = initializeSpeechRecognitionAPI();\n if (!this.recognition) return;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n if (this.ignoreResults) return;\n this.lastKnownResultsLength = event.results.length;\n\n \n const startIndex = Math.max(event.resultIndex, this.resultIndexThreshold);\n if (startIndex >= event.results.length) return;\n\n const { interim, finalized } = parseSpeechRecognitionEvent(event, startIndex);\n this.transcript.update((current) => ({\n interim,\n finalized: finalized.length ? `${current.finalized}${finalized}` : current.finalized\n }));\n this.lastSpeechTime.set(Date.now());\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n console.error('[SpeechService] Recognition error:', event.error);\n if (event.error === 'not-allowed') {\n this.stop();\n }\n };\n\n this.recognition.onend = () => {\n if (this.isListening()) {\n this.startRecognition();\n }\n };\n }\n\n private startRecognition(): void {\n this.ignoreResults = false;\n this.resultIndexThreshold = 0;\n this.lastKnownResultsLength = 0;\n if (!this.recognition) {\n this.setupRecognition();\n }\n\n try {\n this.recognition?.start();\n } catch (error) {\n console.error('[SpeechService] Failed to start recognition:', error);\n this.recognition = null;\n this.setupRecognition();\n (this.recognition as SpeechRecognition | null)?.start();\n }\n }\n\n private stopRecognition(): void {\n if (this.recognition) {\n this.recognition.onend = null;\n this.recognition.onresult = null;\n this.recognition.onerror = null;\n try {\n this.recognition.stop();\n } catch (error) {\n console.error('[SpeechService] Error stopping recognition:', error);\n }\n this.recognition = null;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AACA;SAGgB,8BAA8B,GAAA;IAC5C,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,IAAI;AAC9C,IAAA,IAAI,EAAE,mBAAmB,IAAI,MAAM,CAAC,IAAI,EAAE,yBAAyB,IAAI,MAAM,CAAC,EAAE;AAC9E,QAAA,OAAO,CAAC,IAAI,CAAC,wEAAwE,CAAC;AACtF,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,oBAAoB,GAAI,MAAc,CAAC,iBAAiB,IAAK,MAAc,CAAC,uBAAuB;AACzG,IAAA,MAAM,WAAW,GAAG,IAAI,oBAAoB,EAAE;AAC9C,IAAA,WAAW,CAAC,UAAU,GAAG,IAAI;AAC7B,IAAA,WAAW,CAAC,cAAc,GAAG,IAAI;A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AAA,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;YACzB;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC;YACrE;AACA,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI;QACzB;IACF;uGA7MW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA;;2FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACPlC;;AAEG;;;;"}
@@ -52,9 +52,6 @@ class DatabaseService {
52
52
  return new ErBuilder().build(databases);
53
53
  }
54
54
  async getPageItems(dbId, name) {
55
- // const dbDetails = await this.notion.retrieveDatabase(dbId);
56
- // const items = listDatabaseProperties(dbDetails, name);
57
- // return items;
58
55
  return [];
59
56
  }
60
57
  async getParent(parent) {
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-usecase-database.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/usecase/database/database.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/database/xxmachina-common-usecase-database.ts"],"sourcesContent":["import { inject, Injectable, InjectionToken } from '@angular/core';\nimport { ErBuilder } from '@xxmachina/common/domain/builder';\nimport { ScreenItemBuilder } from '@xxmachina/common/domain/builder/screen-item';\nimport { Database, ScreenItem } from '@xxmachina/common/domain/models';\nimport { omit } from 'lodash-es';\nimport { injectNotion } from '@nx-ddd/notion';\n\nfunction listDatabaseProperties(database: Database, dbName: string): ScreenItem[] {\n return new ScreenItemBuilder().build(database).map(item => ({...item, dbName}));\n}\n\nexport interface DatabaseConfig {\n notionApiKey: string;\n databaseIdToName: { [key: string]: string };\n}\n\nconst DATABASE_CONFIG = new InjectionToken<DatabaseConfig>('DATABASE_CONFIG');\n\nexport function provideDatabaseConfig(useFactory: () => DatabaseConfig) {\n return { provide: DATABASE_CONFIG, useFactory };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class DatabaseService {\n private config = inject(DATABASE_CONFIG);\n private notion = injectNotion();\n\n async get(databaseId: string) {\n return this.notion!.retrieveDatabase(databaseId);\n }\n\n async update(databaseId: string, body: any) {\n return this.notion!.updateDatabase(databaseId, omit({\n ...body.properties,\n }, []));\n }\n\n async listDatabases() {\n let start_cursor: string | undefined;\n const databases: any[] = [];\n\n while (true) {\n const _databases = await this.notion!.search({\n filter: {\n property: 'object',\n value: 'database',\n },\n start_cursor,\n });\n for (const db of _databases.results) {\n databases.push({\n ...db,\n _title: (db as any)['title']?.[0]?.plain_text,\n });\n }\n\n if (!_databases.has_more) break;\n start_cursor = _databases.next_cursor as string | undefined;\n }\n\n const resolve = async (item: any) => ({...item, path: await this.getPath(item)});\n\n return Promise.all(databases.map(db => resolve(db)));\n }\n\n async generateMermaidER(): Promise<string> {\n const databases = await this.listDatabases();\n return new ErBuilder().build(databases); \n }\n\n async getPageItems(dbId: string, name: string) {\n // const dbDetails = await this.notion.retrieveDatabase(dbId);\n // const items = listDatabaseProperties(dbDetails, name);\n // return items;\n return [];\n }\n\n async getParent(parent: {\n type: 'database_id',\n database_id: string\n } | {\n type: 'page_id',\n page_id: string\n } | {\n type: 'block_id',\n block_id: string\n }) {\n switch (parent.type) {\n case 'database_id': return this.notion!.retrieveDatabase(parent.database_id)\n case 'page_id': return this.notion!.retrievePage(parent.page_id);\n case 'block_id': return this.notion!.retrieveBlock(parent.block_id);\n }\n }\n\n async getPath(obj: any) {\n const objects = [obj];\n return objects.map(obj => getTitle(obj)).filter(Boolean).reverse().join('/');\n }\n}\n\nfunction getTitle(obj: any) {\n if (obj.object === 'page') {\n return obj.properties?.title?.title?.[0]?.plain_text;\n } else if (obj.object === 'database') {\n return obj._title;\n } else {\n return null;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA,SAAS,sBAAsB,CAAC,QAAkB,EAAE,MAAc,EAAA;IAChE,OAAO,IAAI,iBAAiB,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,EAAC,GAAG,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;AACjF;AAOA,MAAM,eAAe,GAAG,IAAI,cAAc,CAAiB,iBAAiB,CAAC;AAEvE,SAAU,qBAAqB,CAAC,UAAgC,EAAA;AACpE,IAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE;AACjD;MAGa,eAAe,CAAA;AAClB,IAAA,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;IAChC,MAAM,GAAG,YAAY,EAAE;IAE/B,MAAM,GAAG,CAAC,UAAkB,EAAA;QAC1B,OAAO,IAAI,CAAC,MAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC;IAClD;AAEA,IAAA,MAAM,MAAM,CAAC,UAAkB,EAAE,IAAS,EAAA;QACxC,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC;YAClD,GAAG,IAAI,CAAC,UAAU;SACnB,EAAE,EAAE,CAAC,CAAC;IACT;AAEA,IAAA,MAAM,aAAa,GAAA;AACjB,QAAA,IAAI,YAAgC;QACpC,MAAM,SAAS,GAAU,EAAE;QAE3B,OAAO,IAAI,EAAE;YACX,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAO,CAAC,MAAM,CAAC;AAC3C,gBAAA,MAAM,EAAE;AACN,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,UAAU;AAClB,iBAAA;gBACD,YAAY;AACb,aAAA,CAAC;AACF,YAAA,KAAK,MAA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AAC,GAAG,CAAC;QACrB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;IAC9E;uGA1EW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAf,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AA8ElC,SAAS,QAAQ,CAAC,GAAQ,EAAA;AACxB,IAAA,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;AACzB,QAAA,OAAO,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,UAAU;IACtD;AAAO,SAAA,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,EAAE;QACpC,OAAO,GAAG,CAAC,MAAM;IACnB;SAAO;AACL,QAAA,OAAO,IAAI;IACb;AACF;;AC5GA;;AAEG;;;;"}
1
+ {"version":3,"file":"xxmachina-common-usecase-database.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/usecase/database/database.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/database/xxmachina-common-usecase-database.ts"],"sourcesContent":["import { inject, Injectable, InjectionToken } from '@angular/core';\nimport { ErBuilder } from '@xxmachina/common/domain/builder';\nimport { ScreenItemBuilder } from '@xxmachina/common/domain/builder/screen-item';\nimport { Database, ScreenItem } from '@xxmachina/common/domain/models';\nimport { omit } from 'lodash-es';\nimport { injectNotion } from '@nx-ddd/notion';\n\nfunction listDatabaseProperties(database: Database, dbName: string): ScreenItem[] {\n return new ScreenItemBuilder().build(database).map(item => ({...item, dbName}));\n}\n\nexport interface DatabaseConfig {\n notionApiKey: string;\n databaseIdToName: { [key: string]: string };\n}\n\nconst DATABASE_CONFIG = new InjectionToken<DatabaseConfig>('DATABASE_CONFIG');\n\nexport function provideDatabaseConfig(useFactory: () => DatabaseConfig) {\n return { provide: DATABASE_CONFIG, useFactory };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class DatabaseService {\n private config = inject(DATABASE_CONFIG);\n private notion = injectNotion();\n\n async get(databaseId: string) {\n return this.notion!.retrieveDatabase(databaseId);\n }\n\n async update(databaseId: string, body: any) {\n return this.notion!.updateDatabase(databaseId, omit({\n ...body.properties,\n }, []));\n }\n\n async listDatabases() {\n let start_cursor: string | undefined;\n const databases: any[] = [];\n\n while (true) {\n const _databases = await this.notion!.search({\n filter: {\n property: 'object',\n value: 'database',\n },\n start_cursor,\n });\n for (const db of _databases.results) {\n databases.push({\n ...db,\n _title: (db as any)['title']?.[0]?.plain_text,\n });\n }\n\n if (!_databases.has_more) break;\n start_cursor = _databases.next_cursor as string | undefined;\n }\n\n const resolve = async (item: any) => ({...item, path: await this.getPath(item)});\n\n return Promise.all(databases.map(db => resolve(db)));\n }\n\n async generateMermaidER(): Promise<string> {\n const databases = await this.listDatabases();\n return new ErBuilder().build(databases); \n }\n\n async getPageItems(dbId: string, name: string) {\n \n \n \n return [];\n }\n\n async getParent(parent: {\n type: 'database_id',\n database_id: string\n } | {\n type: 'page_id',\n page_id: string\n } | {\n type: 'block_id',\n block_id: string\n }) {\n switch (parent.type) {\n case 'database_id': return this.notion!.retrieveDatabase(parent.database_id)\n case 'page_id': return this.notion!.retrievePage(parent.page_id);\n case 'block_id': return this.notion!.retrieveBlock(parent.block_id);\n }\n }\n\n async getPath(obj: any) {\n const objects = [obj];\n return objects.map(obj => getTitle(obj)).filter(Boolean).reverse().join('/');\n }\n}\n\nfunction getTitle(obj: any) {\n if (obj.object === 'page') {\n return obj.properties?.title?.title?.[0]?.plain_text;\n } else if (obj.object === 'database') {\n return obj._title;\n } else {\n return null;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA,SAAS,sBAAsB,CAAC,QAAkB,EAAE,MAAc,EAAA;IAChE,OAAO,IAAI,iBAAiB,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,EAAC,GAAG,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;AACjF;AAOA,MAAM,eAAe,GAAG,IAAI,cAAc,CAAiB,iBAAiB,CAAC;AAEvE,SAAU,qBAAqB,CAAC,UAAgC,EAAA;AACpE,IAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE;AACjD;MAGa,eAAe,CAAA;AAClB,IAAA,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;IAChC,MAAM,GAAG,YAAY,EAAE;IAE/B,MAAM,GAAG,CAAC,UAAkB,EAAA;QAC1B,OAAO,IAAI,CAAC,MAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC;IAClD;AAEA,IAAA,MAAM,MAAM,CAAC,UAAkB,EAAE,IAAS,EAAA;QACxC,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC;YAClD,GAAG,IAAI,CAAC,UAAU;SACnB,EAAE,EAAE,CAAC,CAAC;IACT;AAEA,IAAA,MAAM,aAAa,GAAA;AACjB,QAAA,IAAI,YAAgC;QACpC,MAAM,SAAS,GAAU,EAAE;QAE3B,OAAO,IAAI,EAAE;YACX,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAO,CAAC,MAAM,CAAC;AAC3C,gBAAA,MAAM,EAAE;AACN,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,UAAU;AAClB,iBAAA;gBACD,YAAY;AACb,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pB,QAAA,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC;QACrB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;IAC9E;uGA1EW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAf,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AA8ElC,SAAS,QAAQ,CAAC,GAAQ,EAAA;AACxB,IAAA,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;AACzB,QAAA,OAAO,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,UAAU;IACtD;AAAO,SAAA,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,EAAE;QACpC,OAAO,GAAG,CAAC,MAAM;IACnB;SAAO;AACL,QAAA,OAAO,IAAI;IACb;AACF;;AC5GA;;AAEG;;;;"}
@@ -19,7 +19,6 @@ class GraphqlService {
19
19
  dc = injectDataConnectService();
20
20
  constructor() { }
21
21
  async graphql(query) {
22
- // return lastValueFrom(this.http.post('http://localhost:3330/api/dataConnect', {query}));
23
22
  return this.dc.executeGraphqlRead(query);
24
23
  }
25
24
  async makeQuery(instructions) {
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-usecase-graphql.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/usecase/graphql/graphql.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/graphql/xxmachina-common-usecase-graphql.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { injectAnyFunc } from '@nx-ddd/any-func';\nimport { injectDataConnectService } from '@xxmachina/common/infra/external/data-connect';\nimport { IsString } from 'class-validator';\n\nclass Result {\n @IsString()\n query!: string;\n}\n\n@Injectable({providedIn: 'root'})\nexport class GraphqlService {\n protected http = inject(HttpClient);\n protected anyFunc = injectAnyFunc();\n protected dc = injectDataConnectService();\n\n constructor() {}\n\n async graphql(query: string) {\n // return lastValueFrom(this.http.post('http://localhost:3330/api/dataConnect', {query}));\n return this.dc.executeGraphqlRead(query);\n }\n\n async makeQuery(instructions: string) {\n const schemaQuery = `{ __schema { types { name fields { name type { name } } } } }`;\n const schemaResult = await this.graphql(schemaQuery);\n return this.anyFunc.call(instructions, Result, {\n instructions: `\n アシスタントはユーザーの要求を満たすGraphQLクエリを下記のサーバーのスキーマを元に生成します。\n\n ${JSON.stringify(schemaResult, null, 2)}\n `,\n model: 'gpt-4o-mini',\n validator: async (output: any) => this.graphql(output.query).then(() => []).catch(error => [error.message]),\n }).then((result: any) => result.query);\n }\n\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,MAAM,CAAA;AAEV,IAAA,KAAK;AACN;AADC,UAAA,CAAA;AADC,IAAA,QAAQ,EAAE;;AACI,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;MAIJ,cAAc,CAAA;AACf,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,OAAO,GAAG,aAAa,EAAE;IACzB,EAAE,GAAG,wBAAwB,EAAE;AAEzC,IAAA,WAAA,GAAA,EAAe;IAEf,MAAM,OAAO,CAAC,KAAa,EAAA;;QAEzB,OAAO,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;IAC1C;IAEA,MAAM,SAAS,CAAC,YAAoB,EAAA;QAClC,MAAM,WAAW,GAAG,CAAA,6DAAA,CAA+D;QACnF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE;AAC7C,YAAA,YAAY,EAAE;;;UAGV,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,MAAA,CAAA;AACD,YAAA,KAAK,EAAE,aAAa;AACpB,YAAA,SAAS,EAAE,OAAO,MAAW,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5G,SAAA,CAAC,CAAC,IAAI,CAAC,CAAC,MAAW,KAAK,MAAM,CAAC,KAAK,CAAC;IACxC;uGAxBW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;ACXhC;;AAEG;;;;"}
1
+ {"version":3,"file":"xxmachina-common-usecase-graphql.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/usecase/graphql/graphql.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/graphql/xxmachina-common-usecase-graphql.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { injectAnyFunc } from '@nx-ddd/any-func';\nimport { injectDataConnectService } from '@xxmachina/common/infra/external/data-connect';\nimport { IsString } from 'class-validator';\n\nclass Result {\n @IsString()\n query!: string;\n}\n\n@Injectable({providedIn: 'root'})\nexport class GraphqlService {\n protected http = inject(HttpClient);\n protected anyFunc = injectAnyFunc();\n protected dc = injectDataConnectService();\n\n constructor() {}\n\n async graphql(query: string) {\n \n return this.dc.executeGraphqlRead(query);\n }\n\n async makeQuery(instructions: string) {\n const schemaQuery = `{ __schema { types { name fields { name type { name } } } } }`;\n const schemaResult = await this.graphql(schemaQuery);\n return this.anyFunc.call(instructions, Result, {\n instructions: `\n アシスタントはユーザーの要求を満たすGraphQLクエリを下記のサーバーのスキーマを元に生成します。\n\n ${JSON.stringify(schemaResult, null, 2)}\n `,\n model: 'gpt-4o-mini',\n validator: async (output: any) => this.graphql(output.query).then(() => []).catch(error => [error.message]),\n }).then((result: any) => result.query);\n }\n\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,MAAM,CAAA;AAEV,IAAA,KAAK;AACN;AADC,UAAA,CAAA;AADC,IAAA,QAAQ,EAAE;;AACI,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;MAIJ,cAAc,CAAA;AACf,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,OAAO,GAAG,aAAa,EAAE;IACzB,EAAE,GAAG,wBAAwB,EAAE;AAEzC,IAAA,WAAA,GAAA,EAAe;IAEf,MAAM,OAAO,CAAC,KAAa,EAAA;QAEzB,OAAO,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC;IAC1C;IAEA,MAAM,SAAS,CAAC,YAAoB,EAAA;QAClC,MAAM,WAAW,GAAG,CAAA,6DAAA,CAA+D;QACnF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE;AAC7C,YAAA,YAAY,EAAE;;;UAGV,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,MAAA,CAAA;AACD,YAAA,KAAK,EAAE,aAAa;AACpB,YAAA,SAAS,EAAE,OAAO,MAAW,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5G,SAAA,CAAC,CAAC,IAAI,CAAC,CAAC,MAAW,KAAK,MAAM,CAAC,KAAK,CAAC;IACxC;uGAxBW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;ACXhC;;AAEG;;;;"}
@@ -136,7 +136,6 @@ class GraphqlService {
136
136
  dc = injectDataConnectService();
137
137
  constructor() { }
138
138
  async graphql(query) {
139
- // return lastValueFrom(this.http.post('http://localhost:3330/api/dataConnect', {query}));
140
139
  return this.dc.executeGraphqlRead(query);
141
140
  }
142
141
  async makeQuery(instructions) {
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-usecase.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/usecase/assistant/assistant.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/spec/spec.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/project/project.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/graphql/graphql.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/usecase.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/xxmachina-common-usecase.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\nimport { InfrastructureService } from \"@xxmachina/common/infra\";\nimport { AssistantOperator } from \"@xxmachina/common/domain/models\";\nimport { hash } from \"@xxmachina/common/utils/crypto\";\n\n\n@Injectable({providedIn: 'root'})\nexport class AssistantService {\n constructor(\n private infra: InfrastructureService,\n ) { }\n\n async list(): Promise<AssistantOperator[]> {\n return await this.infra.repo.redis.operator.list() as AssistantOperator[];\n }\n\n async create(assistant: AssistantOperator): Promise<AssistantOperator> {\n return this.infra.repo.redis.operator.create(assistant) as any;\n }\n\n async update(assistant: AssistantOperator): Promise<void> {\n return this.infra.repo.redis.operator.update(assistant);\n }\n\n async delete(assistantid: string): Promise<void> {\n return this.infra.repo.redis.operator.delete(assistantid);\n }\n\n async operate(assistantId: string, input: string): Promise<string> {\n const project = await this.infra.repo.redis.project.get('default');\n const assistant = await this.infra.repo.redis.operator.get(assistantId);\n const adapter = this.infra.external.getAiAdapter(project.settings.ai)\n const embeddings = await adapter.embedding(input);\n const specs = await this.infra.repo.redis.spec.search(assistant.id, embeddings);\n\n const messages = [\n {role: 'system', content: assistant.description},\n ...specs.map(spec => [\n {role: 'system', content: spec.input},\n {role: 'assistant', content: spec.output},\n ]).flat(),\n {role: 'user', content: input},\n ];\n\n console.debug('messages', messages);\n const output_ = await adapter.chatComplete(messages);\n const output = this.scrape(assistant.outputInterfaceId, output_);\n await this.infra.repo.redis.spec.create({\n input, output, embeddings, id: hash(input), operatorId: assistant.id,\n }).catch(() => {});\n\n return output;\n }\n\n private scrape(interface_: string, output: string): string {\n if (interface_ === 'interface:codeblock') {\n const [_, ...lines] = (output.split('```')?.[1] ?? '').split('\\n');\n return `\\`\\`\\`\\n${lines.join('\\n')}\\n\\`\\`\\``;\n } else {\n return output;\n }\n }\n\n}\n","import { Injectable } from \"@angular/core\";\nimport { InfrastructureService } from \"@xxmachina/common/infra\";\nimport { Spec } from \"@xxmachina/common/domain/models\";\nimport { hash } from \"@xxmachina/common/utils/crypto\";\n\n@Injectable({providedIn: 'root'})\nexport class SpecService {\n constructor(\n private infra: InfrastructureService,\n ) { }\n\n async list(): Promise<Spec[]> {\n return this.infra.repo.redis.spec.list();\n }\n\n async get(id: string): Promise<Spec> {\n return this.infra.repo.redis.spec.get(id);\n }\n\n async create(spec: Spec): Promise<Spec> {\n const project = await this.infra.repo.redis.project.get('default');\n const embeddings = await this.infra.external.getAiAdapter(project.settings.ai).embedding(spec.input);\n return this.infra.repo.redis.spec.create({...spec, embeddings, id: hash(spec.input)});\n }\n\n async update(spec: Partial<Spec>): Promise<void> {\n const project = await this.infra.repo.redis.project.get('default');\n const embeddings = await this.infra.external.getAiAdapter(project.settings.ai).embedding(spec.input);\n if (spec.id !== hash(spec.input as string)) throw new Error('id is not match with input hash');\n return this.infra.repo.redis.spec.update({...spec, embeddings});\n }\n\n async delete(id: string): Promise<void> {\n return this.infra.repo.redis.spec.delete(id);\n }\n\n}\n","import { Injectable } from \"@angular/core\";\nimport { Project } from \"@xxmachina/common/domain/models\";\nimport { InfrastructureService } from \"@xxmachina/common/infra\";\n\n\n@Injectable({providedIn: 'root'})\nexport class ProjectService {\n constructor(\n private infra: InfrastructureService,\n ) { }\n\n async list(): Promise<Project[]> {\n return await this.infra.repo.redis.project.list() as Project[];\n }\n\n async get(projectId: string): Promise<Project> {\n return this.infra.repo.redis.project.get(projectId);\n }\n\n async create(project: Project): Promise<Project> {\n return this.infra.repo.redis.project.create(project);\n }\n\n async update(project: Project): Promise<void> {\n return this.infra.repo.redis.project.update(project);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { injectAnyFunc } from '@nx-ddd/any-func';\nimport { injectDataConnectService } from '@xxmachina/common/infra/external/data-connect';\nimport { IsString } from 'class-validator';\n\nclass Result {\n @IsString()\n query!: string;\n}\n\n@Injectable({providedIn: 'root'})\nexport class GraphqlService {\n protected http = inject(HttpClient);\n protected anyFunc = injectAnyFunc();\n protected dc = injectDataConnectService();\n\n constructor() {}\n\n async graphql(query: string) {\n // return lastValueFrom(this.http.post('http://localhost:3330/api/dataConnect', {query}));\n return this.dc.executeGraphqlRead(query);\n }\n\n async makeQuery(instructions: string) {\n const schemaQuery = `{ __schema { types { name fields { name type { name } } } } }`;\n const schemaResult = await this.graphql(schemaQuery);\n return this.anyFunc.call(instructions, Result, {\n instructions: `\n アシスタントはユーザーの要求を満たすGraphQLクエリを下記のサーバーのスキーマを元に生成します。\n\n ${JSON.stringify(schemaResult, null, 2)}\n `,\n model: 'gpt-4o-mini',\n validator: async (output: any) => this.graphql(output.query).then(() => []).catch(error => [error.message]),\n }).then((result: any) => result.query);\n }\n\n}","import { inject, Injectable } from \"@angular/core\";\nimport { AssistantService } from \"./assistant\";\nimport { SpecService } from \"./spec\";\nimport { ProjectService } from \"./project\";\nimport { GraphqlService } from \"./graphql\";\n\n@Injectable({providedIn: 'root'})\nexport class UsecaseService {\n readonly assistant = inject(AssistantService)\n readonly project = inject(ProjectService)\n readonly spec = inject(SpecService)\n readonly graphql = inject(GraphqlService);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;MAOa,gBAAgB,CAAA;AAEjB,IAAA,KAAA;AADV,IAAA,WAAA,CACU,KAA4B,EAAA;QAA5B,IAAA,CAAA,KAAK,GAAL,KAAK;IACX;AAEJ,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAyB;IAC3E;IAEA,MAAM,MAAM,CAAC,SAA4B,EAAA;AACvC,QAAA,OAAO,IAAI,CAAC,KAAK,C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AA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1B,IAAA,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC;uGAJ9B,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;ACNhC;;AAEG;;;;"}
1
+ {"version":3,"file":"xxmachina-common-usecase.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/usecase/assistant/assistant.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/spec/spec.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/project/project.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/graphql/graphql.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/usecase.service.ts","../../../../../packages/@xxmachina/common/src/lib/usecase/xxmachina-common-usecase.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\nimport { InfrastructureService } from \"@xxmachina/common/infra\";\nimport { AssistantOperator } from \"@xxmachina/common/domain/models\";\nimport { hash } from \"@xxmachina/common/utils/crypto\";\n\n\n@Injectable({providedIn: 'root'})\nexport class AssistantService {\n constructor(\n private infra: InfrastructureService,\n ) { }\n\n async list(): Promise<AssistantOperator[]> {\n return await this.infra.repo.redis.operator.list() as AssistantOperator[];\n }\n\n async create(assistant: AssistantOperator): Promise<AssistantOperator> {\n return this.infra.repo.redis.operator.create(assistant) as any;\n }\n\n async update(assistant: AssistantOperator): Promise<void> {\n return this.infra.repo.redis.operator.update(assistant);\n }\n\n async delete(assistantid: string): Promise<void> {\n return this.infra.repo.redis.operator.delete(assistantid);\n }\n\n async operate(assistantId: string, input: string): Promise<string> {\n const project = await this.infra.repo.redis.project.get('default');\n const assistant = await this.infra.repo.redis.operator.get(assistantId);\n const adapter = this.infra.external.getAiAdapter(project.settings.ai)\n const embeddings = await adapter.embedding(input);\n const specs = await this.infra.repo.redis.spec.search(assistant.id, embeddings);\n\n const messages = [\n {role: 'system', content: assistant.description},\n ...specs.map(spec => [\n {role: 'system', content: spec.input},\n {role: 'assistant', content: spec.output},\n ]).flat(),\n {role: 'user', content: input},\n ];\n\n console.debug('messages', messages);\n const output_ = await adapter.chatComplete(messages);\n const output = this.scrape(assistant.outputInterfaceId, output_);\n await this.infra.repo.redis.spec.create({\n input, output, embeddings, id: hash(input), operatorId: assistant.id,\n }).catch(() => {});\n\n return output;\n }\n\n private scrape(interface_: string, output: string): string {\n if (interface_ === 'interface:codeblock') {\n const [_, ...lines] = (output.split('```')?.[1] ?? '').split('\\n');\n return `\\`\\`\\`\\n${lines.join('\\n')}\\n\\`\\`\\``;\n } else {\n return output;\n }\n }\n\n}\n","import { Injectable } from \"@angular/core\";\nimport { InfrastructureService } from \"@xxmachina/common/infra\";\nimport { Spec } from \"@xxmachina/common/domain/models\";\nimport { hash } from \"@xxmachina/common/utils/crypto\";\n\n@Injectable({providedIn: 'root'})\nexport class SpecService {\n constructor(\n private infra: InfrastructureService,\n ) { }\n\n async list(): Promise<Spec[]> {\n return this.infra.repo.redis.spec.list();\n }\n\n async get(id: string): Promise<Spec> {\n return this.infra.repo.redis.spec.get(id);\n }\n\n async create(spec: Spec): Promise<Spec> {\n const project = await this.infra.repo.redis.project.get('default');\n const embeddings = await this.infra.external.getAiAdapter(project.settings.ai).embedding(spec.input);\n return this.infra.repo.redis.spec.create({...spec, embeddings, id: hash(spec.input)});\n }\n\n async update(spec: Partial<Spec>): Promise<void> {\n const project = await this.infra.repo.redis.project.get('default');\n const embeddings = await this.infra.external.getAiAdapter(project.settings.ai).embedding(spec.input);\n if (spec.id !== hash(spec.input as string)) throw new Error('id is not match with input hash');\n return this.infra.repo.redis.spec.update({...spec, embeddings});\n }\n\n async delete(id: string): Promise<void> {\n return this.infra.repo.redis.spec.delete(id);\n }\n\n}\n","import { Injectable } from \"@angular/core\";\nimport { Project } from \"@xxmachina/common/domain/models\";\nimport { InfrastructureService } from \"@xxmachina/common/infra\";\n\n\n@Injectable({providedIn: 'root'})\nexport class ProjectService {\n constructor(\n private infra: InfrastructureService,\n ) { }\n\n async list(): Promise<Project[]> {\n return await this.infra.repo.redis.project.list() as Project[];\n }\n\n async get(projectId: string): Promise<Project> {\n return this.infra.repo.redis.project.get(projectId);\n }\n\n async create(project: Project): Promise<Project> {\n return this.infra.repo.redis.project.create(project);\n }\n\n async update(project: Project): Promise<void> {\n return this.infra.repo.redis.project.update(project);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { injectAnyFunc } from '@nx-ddd/any-func';\nimport { injectDataConnectService } from '@xxmachina/common/infra/external/data-connect';\nimport { IsString } from 'class-validator';\n\nclass Result {\n @IsString()\n query!: string;\n}\n\n@Injectable({providedIn: 'root'})\nexport class GraphqlService {\n protected http = inject(HttpClient);\n protected anyFunc = injectAnyFunc();\n protected dc = injectDataConnectService();\n\n constructor() {}\n\n async graphql(query: string) {\n \n return this.dc.executeGraphqlRead(query);\n }\n\n async makeQuery(instructions: string) {\n const schemaQuery = `{ __schema { types { name fields { name type { name } } } } }`;\n const schemaResult = await this.graphql(schemaQuery);\n return this.anyFunc.call(instructions, Result, {\n instructions: `\n アシスタントはユーザーの要求を満たすGraphQLクエリを下記のサーバーのスキーマを元に生成します。\n\n ${JSON.stringify(schemaResult, null, 2)}\n `,\n model: 'gpt-4o-mini',\n validator: async (output: any) => this.graphql(output.query).then(() => []).catch(error => [error.message]),\n }).then((result: any) => result.query);\n }\n\n}","import { inject, Injectable } from \"@angular/core\";\nimport { AssistantService } from \"./assistant\";\nimport { SpecService } from \"./spec\";\nimport { ProjectService } from \"./project\";\nimport { GraphqlService } from \"./graphql\";\n\n@Injectable({providedIn: 'root'})\nexport class UsecaseService {\n readonly assistant = inject(AssistantService)\n readonly project = inject(ProjectService)\n readonly spec = inject(SpecService)\n readonly graphql = inject(GraphqlService);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;MAOa,gBAAgB,CAAA;AAEjB,IAAA,KAAA;AADV,IAAA,WAAA,CACU,KAA4B,EAAA;QAA5B,IAAA,CAAA,KAAK,GAAL,KAAK;IACX;AAEJ,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAyB;IAC3E;IAEA,MAAM,MAAM,CAAC,SAA4B,EAAA;AACvC,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAQ;IAChE;IAEA,MAAM,MAAM,CAAC,SAA4B,EAAA;AACvC,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC;IACzD;IAEA,MAAM,MAAM,CAAC,WAAmB,EAAA;AAC9B,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;IAC3D;AAEA,IAAA,MAAM,OAAO,CAAC,WAAmB,EAAE,KAAa,EAAA;AAC9C,QAAA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;AAClE,QAAA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAA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,CAAC,CAAC,IAAI,CAAC,CAAC,MAAW,KAAK,MAAM,CAAC,KAAK,CAAC;IACxC;uGAxBW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;MCJnB,cAAc,CAAA;AAChB,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACpC,IAAA,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC;AAChC,IAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;AAC1B,IAAA,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC;uGAJ9B,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADF,MAAM,EAAA,CAAA;;2FAClB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;;ACNhC;;AAEG;;;;"}
@@ -1,11 +1,9 @@
1
- // JSONスキーマを受け取り、表示項目のリストを生成する関数
2
1
  function extractDisplayFields(schema, prefix = '', childrenKey = 'children') {
3
2
  const fields = [];
4
3
  if (schema.type === 'object' && schema.properties) {
5
4
  for (const key in schema.properties) {
6
5
  const propertySchema = schema.properties[key];
7
6
  const path = prefix ? `${prefix}.${key}` : key;
8
- // anyOfを処理
9
7
  if (propertySchema.anyOf) {
10
8
  propertySchema.anyOf.forEach((subSchema) => {
11
9
  if (subSchema.type === 'object' || subSchema.type === 'array') {
@@ -15,30 +13,24 @@ function extractDisplayFields(schema, prefix = '', childrenKey = 'children') {
15
13
  });
16
14
  }
17
15
  else if (propertySchema.type === 'array' && propertySchema.items) {
18
- // 配列を処理
19
16
  if (key === childrenKey) {
20
- // childrenKeyに一致する場合、再帰的に処理
21
17
  const arrayFields = extractDisplayFields(propertySchema.items, '', childrenKey);
22
18
  fields.push(...arrayFields);
23
19
  }
24
20
  }
25
21
  else if (propertySchema.type !== 'object') {
26
- // 基本的なプロパティはそのまま追加
27
22
  fields.push(path);
28
23
  }
29
24
  else {
30
- // ネストされたオブジェクトに対して再帰的に呼び出す
31
25
  const nestedFields = extractDisplayFields(propertySchema, path, childrenKey);
32
26
  fields.push(...nestedFields);
33
27
  }
34
- // 特定のプロパティ(costAttribute)を処理
35
28
  if (key === 'costAttribute' && propertySchema.type === 'object') {
36
29
  fields.push(path);
37
30
  }
38
31
  }
39
32
  }
40
33
  else if (schema.type === 'array' && schema.items) {
41
- // ルートが配列の場合を処理
42
34
  const arrayFields = extractDisplayFields(schema.items, '', childrenKey);
43
35
  fields.push(...arrayFields);
44
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-utils.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/utils/extract-display-fields.ts","../../../../../packages/@xxmachina/common/src/lib/utils/xxmachina-common-utils.ts"],"sourcesContent":["import { JsonSchema } from 'json-schema-library';\n\n// JSONスキーマを受け取り、表示項目のリストを生成する関数\nexport function extractDisplayFields(schema: JsonSchema, prefix = '', childrenKey = 'children'): string[] {\n const fields: string[] = [];\n\n if (schema.type === 'object' && schema.properties) {\n for (const key in schema.properties) {\n const propertySchema = schema.properties[key];\n const path = prefix ? `${prefix}.${key}` : key;\n\n // anyOfを処理\n if (propertySchema.anyOf) {\n propertySchema.anyOf.forEach((subSchema: any) => {\n if (subSchema.type === 'object' || subSchema.type === 'array') {\n const nestedFields = extractDisplayFields(subSchema, path, childrenKey);\n fields.push(...nestedFields);\n }\n });\n } else if (propertySchema.type === 'array' && propertySchema.items) {\n // 配列を処理\n if (key === childrenKey) {\n // childrenKeyに一致する場合、再帰的に処理\n const arrayFields = extractDisplayFields(propertySchema.items, '', childrenKey);\n fields.push(...arrayFields);\n }\n } else if (propertySchema.type !== 'object') {\n // 基本的なプロパティはそのまま追加\n fields.push(path);\n } else {\n // ネストされたオブジェクトに対して再帰的に呼び出す\n const nestedFields = extractDisplayFields(propertySchema, path, childrenKey);\n fields.push(...nestedFields);\n }\n\n // 特定のプロパティ(costAttribute)を処理\n if (key === 'costAttribute' && propertySchema.type === 'object') {\n fields.push(path);\n }\n }\n } else if (schema.type === 'array' && schema.items) {\n // ルートが配列の場合を処理\n const arrayFields = extractDisplayFields(schema.items, '', childrenKey);\n fields.push(...arrayFields);\n }\n\n return [...new Set(fields).keys()]\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAEA;AACM,SAAU,oBAAoB,CAAC,MAAkB,EAAE,MAAM,GAAG,EAAE,EAAE,WAAW,GAAG,UAAU,EAAA;IAC5F,MAAM,MAAM,GAAa,EAAE;IAE3B,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE;AACjD,QAAA,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE;YACnC,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;AAC7C,YAAA,MAAM,IAAI,GAAG,MAAM,GAAG,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,GAAG,CAAA,CAAE,GAAG,GAAG;;AAG9C,YAAA,IAAI,cAAc,CAAC,KAAK,EAAE;gBACxB,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CA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AAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC;;AC/CA;;AAEG;;;;"}
1
+ {"version":3,"file":"xxmachina-common-utils.mjs","sources":["../../../../../packages/@xxmachina/common/src/lib/utils/extract-display-fields.ts","../../../../../packages/@xxmachina/common/src/lib/utils/xxmachina-common-utils.ts"],"sourcesContent":["import { JsonSchema } from 'json-schema-library';\n\n\nexport function extractDisplayFields(schema: JsonSchema, prefix = '', childrenKey = 'children'): string[] {\n const fields: string[] = [];\n\n if (schema.type === 'object' && schema.properties) {\n for (const key in schema.properties) {\n const propertySchema = schema.properties[key];\n const path = prefix ? `${prefix}.${key}` : key;\n\n \n if (propertySchema.anyOf) {\n propertySchema.anyOf.forEach((subSchema: any) => {\n if (subSchema.type === 'object' || subSchema.type === 'array') {\n const nestedFields = extractDisplayFields(subSchema, path, childrenKey);\n fields.push(...nestedFields);\n }\n });\n } else if (propertySchema.type === 'array' && propertySchema.items) {\n \n if (key === childrenKey) {\n \n const arrayFields = extractDisplayFields(propertySchema.items, '', childrenKey);\n fields.push(...arrayFields);\n }\n } else if (propertySchema.type !== 'object') {\n \n fields.push(path);\n } else {\n \n const nestedFields = extractDisplayFields(propertySchema, path, childrenKey);\n fields.push(...nestedFields);\n }\n\n \n if (key === 'costAttribute' && propertySchema.type === 'object') {\n fields.push(path);\n }\n }\n } else if (schema.type === 'array' && schema.items) {\n \n const arrayFields = extractDisplayFields(schema.items, '', childrenKey);\n fields.push(...arrayFields);\n }\n\n return [...new Set(fields).keys()]\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAGM,SAAU,oBAAoB,CAAC,MAAkB,EAAE,MAAM,GAAG,EAAE,EAAE,WAAW,GAAG,UAAU,EAAA;IAC5F,MAAM,MAAM,GAAa,EAAE;IAE3B,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE;AACjD,QAAA,KAAK,MAAM,GAAG,IAA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ACnB;QACF;IACF;SAAO,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,KAAK,EAAE;AAElD,QAAA,MAAM,WAAW,GAAG,oBAAoB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,WAAW,CAAC;AACvE,QAAA,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;IAC7B;IAEA,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC;;AC/CA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xxmachina/common",
3
- "version": "19.51.0",
3
+ "version": "19.81.0",
4
4
  "license": "MIT",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -13,11 +13,11 @@
13
13
  "@nestjs/common": "10.2.8",
14
14
  "@nestjs/graphql": "^11.0.0",
15
15
  "@nestjs/passport": "^9.0.3",
16
- "@ng-atomic/common": "19.51.0",
17
- "@ng-atomic/components": "19.51.0",
18
- "@ng-atomic/core": "19.51.0",
19
- "@nx-ddd/common": "19.51.0",
20
- "@nx-ddd/core": "19.51.0",
16
+ "@ng-atomic/common": "19.81.0",
17
+ "@ng-atomic/components": "19.81.0",
18
+ "@ng-atomic/core": "19.81.0",
19
+ "@nx-ddd/common": "19.81.0",
20
+ "@nx-ddd/core": "19.81.0",
21
21
  "@tfarras/nestjs-firebase-auth": "^2.0.0",
22
22
  "apollo-angular": "^7.0.2",
23
23
  "class-transformer": "^0.5.1",
@@ -43,11 +43,11 @@
43
43
  "validate-azure-ad-token": "^2.2.0"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@nx-ddd/any-func": "19.51.0",
47
- "@nx-ddd/firestore": "19.51.0",
48
- "@nx-ddd/google": "19.51.0",
49
- "@nx-ddd/hasura": "19.51.0",
50
- "@nx-ddd/notion": "19.51.0",
46
+ "@nx-ddd/any-func": "19.81.0",
47
+ "@nx-ddd/firestore": "19.81.0",
48
+ "@nx-ddd/google": "19.81.0",
49
+ "@nx-ddd/hasura": "19.81.0",
50
+ "@nx-ddd/notion": "19.81.0",
51
51
  "@notionhq/client": "^2.2.15"
52
52
  },
53
53
  "dependencies": {
@@ -211,6 +211,10 @@
211
211
  "types": "./types/xxmachina-common-invoice-usecase-partner.d.ts",
212
212
  "default": "./fesm2022/xxmachina-common-invoice-usecase-partner.mjs"
213
213
  },
214
+ "./services/device-profile": {
215
+ "types": "./types/xxmachina-common-services-device-profile.d.ts",
216
+ "default": "./fesm2022/xxmachina-common-services-device-profile.mjs"
217
+ },
214
218
  "./services/graphql": {
215
219
  "types": "./types/xxmachina-common-services-graphql.d.ts",
216
220
  "default": "./fesm2022/xxmachina-common-services-graphql.mjs"
@@ -1,18 +1,3 @@
1
- /**
2
- * 「画面全体クリア相当」の ANSI エスケープシーケンス一覧。
3
- *
4
- * accumulator / outputBuffer を truncate する判定に使う。
5
- * client 側 `session-qtp.feature.ts` と server 側 `pty-data-handler.ts` が
6
- * 同じ semantics を持つため、ここで単一 source of truth として定義する。
7
- *
8
- * 除外されるもの(履歴欠落防止のため):
9
- * - `\x1b[?1049h` / `\x1b[?1049l`: alt screen 切替。xterm では main/alt を両方保持。
10
- * truncate すると main/alt の履歴が欠落し xterm が正しく切替復元できない。
11
- * - `\x1b[H\x1b[J` / `\x1b[H\x1b[0J`: cursor home + eraseDown。Ink / log-update 系の
12
- * 差分 rendering でも使われ、全画面クリアとは限らない。過剰検出で会話履歴が消える。
13
- *
14
- * 関連設計: `projects/@machina.at/components/docs/design/fix/20260425_qtp-clear-sequences-sync.md`
15
- */
16
1
  declare const CLEAR_SEQUENCES: readonly string[];
17
2
 
18
3
  export { CLEAR_SEQUENCES };
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-_shared-ansi.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/_shared/ansi/clear-sequences.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;AAcG;AACH,cAAA,eAAA;;;;"}
1
+ {"version":3,"file":"xxmachina-common-_shared-ansi.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/_shared/ansi/clear-sequences.ts"],"sourcesContent":[null],"names":[],"mappings":"AACA,cAAA,eAAA;;;;"}
@@ -2,10 +2,6 @@ import { EnvironmentProviders } from '@angular/core';
2
2
  export { AuthService as FirebaseAuthService } from '@ng-atomic/common/services/auth';
3
3
 
4
4
  declare const LOGOUT_CONFIRM_MESSAGE = "\u30ED\u30B0\u30A2\u30A6\u30C8\u3057\u307E\u3059\u304B\uFF1F";
5
- /**
6
- * SIGN_OUT effect factory。window.confirm で確認ダイアログを表示し、
7
- * OK の時のみ signOut() を実行する。
8
- */
9
5
  declare function createSignOutEffect(): () => Promise<void> | undefined;
10
6
  declare function provideAuthService(config?: {}): EnvironmentProviders;
11
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-auth-firebase.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/auth/firebase/firebase-auth.di.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAMA,cAAA,sBAAA;AAEA;;;AAGG;AACH,iBAAA,mBAAA,UAAA,OAAA;AAUA,iBAAA,kBAAA,eAAA,oBAAA;;;;"}
1
+ {"version":3,"file":"xxmachina-common-auth-firebase.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/auth/firebase/firebase-auth.di.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAMA,cAAA,sBAAA;AAGA,iBAAA,mBAAA,UAAA,OAAA;AAUA,iBAAA,kBAAA,eAAA,oBAAA;;;;"}
@@ -1,31 +1,16 @@
1
1
  import { Database, ScreenItem } from '@xxmachina/common/domain/models';
2
2
 
3
- /**
4
- * データベースから画面項目リストを構築するビルダー
5
- */
6
3
  declare class ScreenItemBuilder {
7
4
  build(database: Database): ScreenItem[];
8
5
  }
9
6
 
10
- /**
11
- * Notionプロパティタイプ別の設定マッピング
12
- */
13
7
  interface NotionPropertyConfig {
14
8
  type: ScreenItem['type'];
15
9
  notionPropType: string;
16
10
  valueType: ScreenItem['valueType'];
17
11
  }
18
- /**
19
- * Notionプロパティタイプから画面項目設定へのマッピング
20
- */
21
12
  declare const NOTION_PROPERTY_CONFIG_MAP: Record<string, NotionPropertyConfig>;
22
- /**
23
- * デフォルト設定(未知のプロパティタイプ用)
24
- */
25
13
  declare const DEFAULT_PROPERTY_CONFIG: NotionPropertyConfig;
26
- /**
27
- * プロパティタイプから設定を取得
28
- */
29
14
  declare function getPropertyConfig(propertyType: string): NotionPropertyConfig;
30
15
 
31
16
  export { DEFAULT_PROPERTY_CONFIG, NOTION_PROPERTY_CONFIG_MAP, ScreenItemBuilder, getPropertyConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-domain-builder-screen-item.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/screen-item.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/notion-property-config.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;AA0BA;;AAEG;AACH;AACE;AAcD;;AC1CD;;AAEG;;AAED;;AAEA;AACD;AAED;;AAEG;AACH;AAqBA;;AAEG;AACH;AAMA;;AAEG;AACH;;;"}
1
+ {"version":3,"file":"xxmachina-common-domain-builder-screen-item.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/screen-item.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/notion-property-config.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;AAyBA;AACE;AAcD;;;ACpCC;;AAEA;AACD;AAGD;AAsBA;AAOA;;;"}
@@ -44,13 +44,7 @@ declare class CommandActionsBuilder {
44
44
  buildItemActions<T>(): (item: T) => Action[];
45
45
  }
46
46
 
47
- /**
48
- * コマンド用のナビゲーションアクションを作成
49
- */
50
47
  declare function createCommandNavigateAction(command: Command, navigationExtras?: NavigationExtras, item?: any, options?: CommandActionFactoryOptions, overwrite?: Partial<Action>): Action | null;
51
- /**
52
- * コマンド用の実行アクションを作成
53
- */
54
48
  declare function createCommandExecutionAction(command: Command, item?: any, options?: CommandActionFactoryOptions, overwrite?: Partial<Action>): Action | null;
55
49
 
56
50
  interface Schema {
@@ -82,32 +76,17 @@ declare class QueryBuilder {
82
76
  }, meta?: Partial<Omit<Query, 'graphql'>>): Query;
83
77
  }
84
78
 
85
- /**
86
- * データベースから画面項目リストを構築するビルダー
87
- */
88
79
  declare class ScreenItemBuilder {
89
80
  build(database: Database): ScreenItem[];
90
81
  }
91
82
 
92
- /**
93
- * Notionプロパティタイプ別の設定マッピング
94
- */
95
83
  interface NotionPropertyConfig {
96
84
  type: ScreenItem['type'];
97
85
  notionPropType: string;
98
86
  valueType: ScreenItem['valueType'];
99
87
  }
100
- /**
101
- * Notionプロパティタイプから画面項目設定へのマッピング
102
- */
103
88
  declare const NOTION_PROPERTY_CONFIG_MAP: Record<string, NotionPropertyConfig>;
104
- /**
105
- * デフォルト設定(未知のプロパティタイプ用)
106
- */
107
89
  declare const DEFAULT_PROPERTY_CONFIG: NotionPropertyConfig;
108
- /**
109
- * プロパティタイプから設定を取得
110
- */
111
90
  declare function getPropertyConfig(propertyType: string): NotionPropertyConfig;
112
91
 
113
92
  export { ActionId, CommandActionsBuilder, CommandBuilder, DEFAULT_PROPERTY_CONFIG, ErBuilder, NOTION_PROPERTY_CONFIG_MAP, QueryBuilder, ScreenItemBuilder, createCommandExecutionAction, createCommandNavigateAction, getPropertyConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"xxmachina-common-domain-builder.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/domain/builder/command/command.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/command-action/command-action.types.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/command-action/command-action.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/command-action/command-action.helpers.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/er/er.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/query/query.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/screen-item.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/notion-property-config.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;AAEA;AACE;AAoBD;;ACrBD;AACE;AACA;AACD;AAEK;;;AAGL;AAEK;;;AAGJ;;;;AAID;;ACXD;;;;;;AAOE;AAUA;;AAYA;AAMA;;;;AAOA;AAMA;AAMA;AAmBA;;AA2BD;;ACtGD;;AAEG;AACH;AAgBA;;AAEG;AACH;;AC5BA;;;;AAIC;AAED;;;;;AAKC;AAgCD;AACE;;AAgBS;AAA4B;AAkDrC;AAmBD;;AC7HD;AACE;;;AAGE;AACA;;AAED;AAmBF;;ACJD;;AAEG;AACH;AACE;AAcD;;AC1CD;;AAEG;;AAED;;AAEA;AACD;AAED;;AAEG;AACH;AAqBA;;AAEG;AACH;AAMA;;AAEG;AACH;;;"}
1
+ {"version":3,"file":"xxmachina-common-domain-builder.d.ts","sources":["../../../../../packages/@xxmachina/common/src/lib/domain/builder/command/command.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/command-action/command-action.types.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/command-action/command-action.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/command-action/command-action.helpers.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/er/er.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/query/query.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/screen-item.builder.ts","../../../../../packages/@xxmachina/common/src/lib/domain/builder/screen-item/notion-property-config.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;AAEA;AACE;AAoBD;;ACrBD;AACE;AACA;AACD;AAEK;;;AAGL;AAEK;;;AAGJ;;;;AAID;;ACXD;;;;;;AAOE;AAUA;;AAYA;AAMA;;;;AAOA;AAMA;AAMA;AAmBA;;AA2BD;;ACrGD;AAiBA;;ACxBA;;;;AAIC;AAED;;;;;AAKC;AAgCD;AACE;;AAgBS;AAA4B;AAkDrC;AAmBD;;AC7HD;AACE;;;AAGE;AACA;;AAED;AAmBF;;ACLD;AACE;AAcD;;;ACpCC;;AAEA;AACD;AAGD;AAsBA;AAOA;;;"}