@mathrunet/masamune_workflow_sales 3.8.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 (31) hide show
  1. package/CHANGELOG.md +361 -0
  2. package/LICENSE +21 -0
  3. package/README.md +70 -0
  4. package/dist/clients/app_store_scraper_client.d.ts +93 -0
  5. package/dist/clients/app_store_scraper_client.js +252 -0
  6. package/dist/clients/app_store_scraper_client.js.map +1 -0
  7. package/dist/clients/google_play_scraper_client.d.ts +92 -0
  8. package/dist/clients/google_play_scraper_client.js +240 -0
  9. package/dist/clients/google_play_scraper_client.js.map +1 -0
  10. package/dist/clients/website_contact_client.d.ts +77 -0
  11. package/dist/clients/website_contact_client.js +262 -0
  12. package/dist/clients/website_contact_client.js.map +1 -0
  13. package/dist/functions/collect_app_store_developers.d.ts +29 -0
  14. package/dist/functions/collect_app_store_developers.js +231 -0
  15. package/dist/functions/collect_app_store_developers.js.map +1 -0
  16. package/dist/functions/collect_google_play_developers.d.ts +38 -0
  17. package/dist/functions/collect_google_play_developers.js +239 -0
  18. package/dist/functions/collect_google_play_developers.js.map +1 -0
  19. package/dist/functions.d.ts +20 -0
  20. package/dist/functions.js +65 -0
  21. package/dist/functions.js.map +1 -0
  22. package/dist/index.d.ts +18 -0
  23. package/dist/index.js +35 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/models/app_store_developer_data.d.ts +176 -0
  26. package/dist/models/app_store_developer_data.js +3 -0
  27. package/dist/models/app_store_developer_data.js.map +1 -0
  28. package/dist/models/google_play_developer_data.d.ts +165 -0
  29. package/dist/models/google_play_developer_data.js +3 -0
  30. package/dist/models/google_play_developer_data.js.map +1 -0
  31. package/package.json +61 -0
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CollectGooglePlayDevelopers = void 0;
37
+ const admin = __importStar(require("firebase-admin"));
38
+ const masamune_firebase_workflow_1 = require("@mathrunet/masamune_firebase_workflow");
39
+ const google_play_scraper_client_1 = require("../clients/google_play_scraper_client");
40
+ /**
41
+ * A function for collecting developer information from Google Play.
42
+ *
43
+ * Google Playからデベロッパー情報を収集するためのFunction。
44
+ */
45
+ class CollectGooglePlayDevelopers extends masamune_firebase_workflow_1.WorkflowProcessFunctionBase {
46
+ /**
47
+ * The ID of the function.
48
+ *
49
+ * 関数のID。
50
+ */
51
+ id = "collect_google_play_developers";
52
+ /**
53
+ * The process of the function.
54
+ *
55
+ * @param context The context of the function.
56
+ * @returns The action of the function.
57
+ */
58
+ async process(context) {
59
+ const action = context.action;
60
+ const params = action.command?.data;
61
+ // 1. Validate parameters
62
+ if (!params?.mode) {
63
+ console.warn("CollectGooglePlayDevelopers: No mode specified");
64
+ return {
65
+ ...action,
66
+ results: {
67
+ googlePlayDevelopers: {
68
+ stats: {
69
+ mode: "unknown",
70
+ targetCount: 0,
71
+ collectedCount: 0,
72
+ withEmailCount: 0,
73
+ savedCount: 0
74
+ },
75
+ developers: [],
76
+ error: "No mode specified in command parameters"
77
+ }
78
+ }
79
+ };
80
+ }
81
+ // 2. Initialize client
82
+ const client = new google_play_scraper_client_1.GooglePlayScraperClient({
83
+ lang: params.lang ?? "ja",
84
+ country: params.country ?? "jp"
85
+ });
86
+ const maxCount = params.maxCount ?? 100;
87
+ const collectedDevelopers = [];
88
+ const processedDevIds = new Set();
89
+ let savedCount = 0;
90
+ try {
91
+ // 3. Get target developer IDs based on mode
92
+ let targetDevIds = [];
93
+ switch (params.mode) {
94
+ case "developer_ids":
95
+ targetDevIds = params.developerIds ?? [];
96
+ break;
97
+ case "category_ranking":
98
+ if (!params.categoryConfig) {
99
+ throw new Error("categoryConfig is required for category_ranking mode");
100
+ }
101
+ const listApps = await client.getListApps(params.categoryConfig);
102
+ targetDevIds = client.extractDeveloperIds(listApps);
103
+ break;
104
+ case "search_keyword":
105
+ if (!params.searchConfig) {
106
+ throw new Error("searchConfig is required for search_keyword mode");
107
+ }
108
+ const searchApps = await client.searchApps(params.searchConfig);
109
+ targetDevIds = client.extractDeveloperIds(searchApps);
110
+ break;
111
+ default:
112
+ throw new Error(`Unknown mode: ${params.mode}`);
113
+ }
114
+ console.log(`CollectGooglePlayDevelopers: Found ${targetDevIds.length} target developers`);
115
+ // 4. Collect developer information
116
+ for (const devId of targetDevIds) {
117
+ if (collectedDevelopers.length >= maxCount) {
118
+ console.log(`CollectGooglePlayDevelopers: Reached maxCount limit (${maxCount})`);
119
+ break;
120
+ }
121
+ if (processedDevIds.has(devId)) {
122
+ continue;
123
+ }
124
+ processedDevIds.add(devId);
125
+ try {
126
+ const devInfo = await client.getDeveloperInfo(devId);
127
+ if (devInfo) {
128
+ collectedDevelopers.push(devInfo);
129
+ // 5. Save to Firestore
130
+ await this.saveToFirestore(devInfo);
131
+ savedCount++;
132
+ console.log(`CollectGooglePlayDevelopers: Collected ${devInfo.developerName} (email: ${devInfo.email ?? "none"})`);
133
+ }
134
+ }
135
+ catch (err) {
136
+ console.warn(`CollectGooglePlayDevelopers: Failed to collect developer: ${devId}`, err.message);
137
+ }
138
+ }
139
+ // 6. Create statistics
140
+ const stats = {
141
+ mode: params.mode,
142
+ targetCount: targetDevIds.length,
143
+ collectedCount: collectedDevelopers.length,
144
+ withEmailCount: collectedDevelopers.filter(d => d.email).length,
145
+ savedCount: savedCount
146
+ };
147
+ const result = {
148
+ stats: stats,
149
+ developers: collectedDevelopers
150
+ };
151
+ console.log(`CollectGooglePlayDevelopers: Completed - ${stats.collectedCount} collected, ${stats.withEmailCount} with email`);
152
+ // 7. Return results
153
+ return {
154
+ ...action,
155
+ results: {
156
+ googlePlayDevelopers: result
157
+ }
158
+ };
159
+ }
160
+ catch (error) {
161
+ console.error("CollectGooglePlayDevelopers: Failed to collect data", error);
162
+ return {
163
+ ...action,
164
+ results: {
165
+ googlePlayDevelopers: {
166
+ stats: {
167
+ mode: params.mode,
168
+ targetCount: 0,
169
+ collectedCount: collectedDevelopers.length,
170
+ withEmailCount: collectedDevelopers.filter(d => d.email).length,
171
+ savedCount: savedCount
172
+ },
173
+ developers: collectedDevelopers,
174
+ error: error.message
175
+ }
176
+ }
177
+ };
178
+ }
179
+ }
180
+ /**
181
+ * Save developer info to Firestore.
182
+ *
183
+ * デベロッパー情報をFirestoreに保存。
184
+ *
185
+ * @param devInfo Developer information / デベロッパー情報
186
+ */
187
+ async saveToFirestore(devInfo) {
188
+ const firestore = admin.firestore();
189
+ const docId = `googlePlay_${this.sanitizeId(devInfo.developerId)}`;
190
+ const docPath = `plugins/workflow/address/${docId}`;
191
+ const now = admin.firestore.Timestamp.now();
192
+ // Convert ModelTimestamp to Firestore Timestamp
193
+ const collectedTimestamp = devInfo.collectedTime
194
+ ? admin.firestore.Timestamp.fromDate(devInfo.collectedTime.value())
195
+ : now;
196
+ // Build document, omitting undefined values
197
+ const addressDoc = {
198
+ source: "googlePlay",
199
+ developerId: devInfo.developerId,
200
+ developerName: devInfo.developerName,
201
+ appNames: devInfo.apps.slice(0, 5).map(a => a.title),
202
+ appSummaries: devInfo.apps.slice(0, 3).map(a => a.summary ?? ""),
203
+ appCount: devInfo.apps.length,
204
+ collectedTime: collectedTimestamp,
205
+ updatedTime: now
206
+ };
207
+ // Add optional fields only if they have values
208
+ if (devInfo.companyName)
209
+ addressDoc.companyName = devInfo.companyName;
210
+ if (devInfo.email)
211
+ addressDoc.email = devInfo.email;
212
+ if (devInfo.website)
213
+ addressDoc.website = devInfo.website;
214
+ if (devInfo.privacyPolicyUrl)
215
+ addressDoc.privacyPolicyUrl = devInfo.privacyPolicyUrl;
216
+ if (devInfo.address)
217
+ addressDoc.address = devInfo.address;
218
+ await firestore.doc(docPath).set(addressDoc, { merge: true });
219
+ }
220
+ /**
221
+ * Sanitize developer ID for Firestore document ID.
222
+ *
223
+ * FirestoreドキュメントID用にデベロッパーIDをサニタイズ。
224
+ *
225
+ * @param id Developer ID / デベロッパーID
226
+ * @returns Sanitized ID / サニタイズされたID
227
+ */
228
+ sanitizeId(id) {
229
+ return id
230
+ .replace(/[\/\.#\$\[\]]/g, "_")
231
+ .replace(/\s+/g, "_")
232
+ .replace(/,/g, "");
233
+ }
234
+ }
235
+ exports.CollectGooglePlayDevelopers = CollectGooglePlayDevelopers;
236
+ module.exports = (regions, options, data) => new CollectGooglePlayDevelopers(options).build(regions);
237
+ // Export class for testing
238
+ module.exports.CollectGooglePlayDevelopers = CollectGooglePlayDevelopers;
239
+ //# sourceMappingURL=collect_google_play_developers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect_google_play_developers.js","sourceRoot":"","sources":["../../src/functions/collect_google_play_developers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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AO,CAAC,CAAC;AAE7D,2BAA2B;AAC3B,MAAM,CAAC,OAAO,CAAC,2BAA2B,GAAG,2BAA2B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import * as masamune from "@mathrunet/masamune_firebase";
2
+ /**
3
+ * Define a list of applicable Functions for FirebaseFunctions.
4
+ *
5
+ * FirebaseFunctions用の適用可能なFunctionの一覧を定義します。
6
+ */
7
+ export declare const Functions: {
8
+ /**
9
+ * A function for collecting developer information from Google Play public pages.
10
+ *
11
+ * Google Playの公開ページからデベロッパー情報を収集するためのFunction。
12
+ */
13
+ readonly collectGooglePlayDevelopers: (options?: masamune.HttpFunctionsOptions) => masamune.FunctionsData;
14
+ /**
15
+ * A function for collecting developer information from App Store public pages.
16
+ *
17
+ * App Storeの公開ページからデベロッパー情報を収集するためのFunction。
18
+ */
19
+ readonly collectAppStoreDevelopers: (options?: masamune.HttpFunctionsOptions) => masamune.FunctionsData;
20
+ };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Functions = void 0;
37
+ const masamune = __importStar(require("@mathrunet/masamune_firebase"));
38
+ /**
39
+ * Define a list of applicable Functions for FirebaseFunctions.
40
+ *
41
+ * FirebaseFunctions用の適用可能なFunctionの一覧を定義します。
42
+ */
43
+ exports.Functions = {
44
+ /**
45
+ * A function for collecting developer information from Google Play public pages.
46
+ *
47
+ * Google Playの公開ページからデベロッパー情報を収集するためのFunction。
48
+ */
49
+ collectGooglePlayDevelopers: (options = {}) => new masamune.FunctionsData({
50
+ id: "collect_google_play_developers",
51
+ func: require("./functions/collect_google_play_developers"),
52
+ options: options
53
+ }),
54
+ /**
55
+ * A function for collecting developer information from App Store public pages.
56
+ *
57
+ * App Storeの公開ページからデベロッパー情報を収集するためのFunction。
58
+ */
59
+ collectAppStoreDevelopers: (options = {}) => new masamune.FunctionsData({
60
+ id: "collect_app_store_developers",
61
+ func: require("./functions/collect_app_store_developers"),
62
+ options: options
63
+ }),
64
+ };
65
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AAEzD;;;;GAIG;AACU,QAAA,SAAS,GAAG;IACrB;;;;OAIG;IACH,2BAA2B,EAAE,CAAC,UAAyC,EAAE,EAAE,EAAE,CACzE,IAAI,QAAQ,CAAC,aAAa,CAAC;QACvB,EAAE,EAAE,gCAAgC;QACpC,IAAI,EAAE,OAAO,CAAC,4CAA4C,CAAC;QAC3D,OAAO,EAAE,OAAO;KACnB,CAAC;IAEN;;;;OAIG;IACH,yBAAyB,EAAE,CAAC,UAAyC,EAAE,EAAE,EAAE,CACvE,IAAI,QAAQ,CAAC,aAAa,CAAC;QACvB,EAAE,EAAE,8BAA8B;QAClC,IAAI,EAAE,OAAO,CAAC,0CAA0C,CAAC;QACzD,OAAO,EAAE,OAAO;KACnB,CAAC;CACA,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025 mathru. All rights reserved.
3
+ *
4
+ * Masamune framework package plugin that manages sales tools for Masamune Workflow.
5
+ *
6
+ * To use, import * as m from "@mathrunet/masamune_workflow_sales";
7
+ *
8
+ * [mathru.net]: https://mathru.net
9
+ * [YouTube]: https://www.youtube.com/c/mathrunetchannel
10
+ */
11
+ export * from "@mathrunet/masamune";
12
+ export * from "@mathrunet/masamune_firebase";
13
+ export * from "./functions";
14
+ export * from "./models/google_play_developer_data";
15
+ export * from "./models/app_store_developer_data";
16
+ export * from "./clients/google_play_scraper_client";
17
+ export * from "./clients/app_store_scraper_client";
18
+ export * from "./clients/website_contact_client";
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Copyright (c) 2025 mathru. All rights reserved.
19
+ *
20
+ * Masamune framework package plugin that manages sales tools for Masamune Workflow.
21
+ *
22
+ * To use, import * as m from "@mathrunet/masamune_workflow_sales";
23
+ *
24
+ * [mathru.net]: https://mathru.net
25
+ * [YouTube]: https://www.youtube.com/c/mathrunetchannel
26
+ */
27
+ __exportStar(require("@mathrunet/masamune"), exports);
28
+ __exportStar(require("@mathrunet/masamune_firebase"), exports);
29
+ __exportStar(require("./functions"), exports);
30
+ __exportStar(require("./models/google_play_developer_data"), exports);
31
+ __exportStar(require("./models/app_store_developer_data"), exports);
32
+ __exportStar(require("./clients/google_play_scraper_client"), exports);
33
+ __exportStar(require("./clients/app_store_scraper_client"), exports);
34
+ __exportStar(require("./clients/website_contact_client"), exports);
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,sDAAoC;AACpC,+DAA6C;AAC7C,8CAA4B;AAC5B,sEAAoD;AACpD,oEAAkD;AAClD,uEAAqD;AACrD,qEAAmD;AACnD,mEAAiD"}
@@ -0,0 +1,176 @@
1
+ import { ModelTimestamp } from "@mathrunet/masamune";
2
+ /**
3
+ * App Store developer's app information.
4
+ *
5
+ * App Storeデベロッパーのアプリ情報。
6
+ */
7
+ export interface AppStoreDeveloperApp {
8
+ /** App ID (track ID) / アプリID(トラックID) */
9
+ id: number;
10
+ /** Bundle ID / バンドルID */
11
+ appId: string;
12
+ /** App title / アプリ名 */
13
+ title: string;
14
+ /** App description / アプリ説明 */
15
+ description?: string;
16
+ /** Rating score / 評価スコア */
17
+ score?: number;
18
+ /** Icon URL / アイコンURL */
19
+ icon?: string;
20
+ /** Primary genre / メインジャンル */
21
+ primaryGenre?: string;
22
+ /** Price (0 = free) / 価格(0=無料) */
23
+ price?: number;
24
+ /** Is free / 無料かどうか */
25
+ free?: boolean;
26
+ }
27
+ /**
28
+ * App Store developer information.
29
+ *
30
+ * App Storeデベロッパー情報。
31
+ */
32
+ export interface AppStoreDeveloperInfo {
33
+ /** Developer ID (artist ID - numeric) / デベロッパーID(artistID - 数値) */
34
+ developerId: number;
35
+ /** Developer name / デベロッパー名 */
36
+ developerName: string;
37
+ /** Company name / 会社名 */
38
+ companyName?: string;
39
+ /** Email address (extracted from website) / メールアドレス(Webサイトから抽出) */
40
+ email?: string;
41
+ /** Website URL / WebサイトURL */
42
+ website?: string;
43
+ /** Developer URL (iTunes URL) / デベロッパーURL(iTunes URL) */
44
+ developerUrl?: string;
45
+ /** Contact page URLs / 問い合わせページURL一覧 */
46
+ contactPageUrls?: string[];
47
+ /** Released apps / リリースアプリ一覧 */
48
+ apps: AppStoreDeveloperApp[];
49
+ /** Collection time / 収集日時 */
50
+ collectedTime: ModelTimestamp;
51
+ }
52
+ /**
53
+ * Exploration mode for collecting developers.
54
+ *
55
+ * デベロッパー収集の探索モード。
56
+ */
57
+ export type AppStoreExplorationMode = "developer_ids" | "category_ranking" | "search_keyword";
58
+ /**
59
+ * Category ranking configuration for App Store.
60
+ *
61
+ * App Store用カテゴリランキング設定。
62
+ */
63
+ export interface AppStoreCategoryRankingConfig {
64
+ /** Category ID (numeric) / カテゴリID(数値) */
65
+ category?: number;
66
+ /** Collection (e.g., "TOP_FREE_IOS", "TOP_PAID_IOS") / コレクション */
67
+ collection?: string;
68
+ /** Number of apps to fetch / 取得するアプリ数 */
69
+ num?: number;
70
+ }
71
+ /**
72
+ * Search configuration for App Store.
73
+ *
74
+ * App Store用検索設定。
75
+ */
76
+ export interface AppStoreSearchConfig {
77
+ /** Search term / 検索キーワード */
78
+ term: string;
79
+ /** Number of results / 取得数 */
80
+ num?: number;
81
+ }
82
+ /**
83
+ * Parameters for collect_app_store_developers action.
84
+ *
85
+ * collect_app_store_developersアクションのパラメータ。
86
+ */
87
+ export interface CollectAppStoreDevelopersParams {
88
+ /** Exploration mode / 探索モード */
89
+ mode: AppStoreExplorationMode;
90
+ /** Language code (default: "ja") / 言語コード */
91
+ lang?: string;
92
+ /** Country code (default: "jp") / 国コード */
93
+ country?: string;
94
+ /** Maximum number of developers to collect / 最大収集件数 */
95
+ maxCount?: number;
96
+ /** Mode A: Developer ID list (numeric) / モードA: デベロッパーIDリスト(数値) */
97
+ developerIds?: number[];
98
+ /** Mode B: Category ranking config / モードB: カテゴリランキング設定 */
99
+ categoryConfig?: AppStoreCategoryRankingConfig;
100
+ /** Mode C: Search config / モードC: 検索設定 */
101
+ searchConfig?: AppStoreSearchConfig;
102
+ }
103
+ /**
104
+ * Address document for Firestore (App Store version).
105
+ *
106
+ * Firestore用アドレスドキュメント(App Store版)。
107
+ */
108
+ export interface AppStoreAddressDocument {
109
+ /** Source identifier / ソース識別子 */
110
+ source: "appStore";
111
+ /** Developer ID (numeric) / デベロッパーID(数値) */
112
+ developerId: number;
113
+ /** Developer name / デベロッパー名 */
114
+ developerName: string;
115
+ /** Company name / 会社名 */
116
+ companyName?: string;
117
+ /** Email address (extracted from website) / メールアドレス(Webサイトから抽出) */
118
+ email?: string;
119
+ /** Website URL / WebサイトURL */
120
+ website?: string;
121
+ /** Developer URL (iTunes URL) / デベロッパーURL(iTunes URL) */
122
+ developerUrl?: string;
123
+ /** Contact page URLs / 問い合わせページURL一覧 */
124
+ contactPageUrls?: string[];
125
+ /** Representative app names / 代表アプリ名リスト */
126
+ appNames: string[];
127
+ /** Representative app descriptions / 代表アプリ説明リスト */
128
+ appDescriptions: string[];
129
+ /** Total app count / アプリ総数 */
130
+ appCount: number;
131
+ /** Collection time / 収集日時 */
132
+ collectedTime: FirebaseFirestore.Timestamp;
133
+ /** Update time / 更新日時 */
134
+ updatedTime: FirebaseFirestore.Timestamp;
135
+ }
136
+ /**
137
+ * Collection result statistics for App Store.
138
+ *
139
+ * App Store用収集結果の統計情報。
140
+ */
141
+ export interface AppStoreCollectionStats {
142
+ /** Exploration mode used / 使用した探索モード */
143
+ mode: AppStoreExplorationMode;
144
+ /** Number of target developers / 対象デベロッパー数 */
145
+ targetCount: number;
146
+ /** Number of collected developers / 収集したデベロッパー数 */
147
+ collectedCount: number;
148
+ /** Number of developers with email (extracted from website) / メールありのデベロッパー数(Webサイトから抽出) */
149
+ withEmailCount: number;
150
+ /** Number of saved documents / 保存したドキュメント数 */
151
+ savedCount: number;
152
+ }
153
+ /**
154
+ * Result structure for collect_app_store_developers action.
155
+ *
156
+ * collect_app_store_developersアクションの結果構造。
157
+ */
158
+ export interface CollectAppStoreDevelopersResult {
159
+ /** Collection statistics / 収集統計 */
160
+ stats: AppStoreCollectionStats;
161
+ /** Collected developer information / 収集したデベロッパー情報 */
162
+ developers: AppStoreDeveloperInfo[];
163
+ /** Error message if any / エラーメッセージ */
164
+ error?: string;
165
+ }
166
+ /**
167
+ * Contact information extracted from website.
168
+ *
169
+ * Webサイトから抽出したコンタクト情報。
170
+ */
171
+ export interface WebsiteContactInfo {
172
+ /** Extracted email addresses / 抽出されたメールアドレス */
173
+ emails: string[];
174
+ /** Contact page URLs / 問い合わせページURL */
175
+ contactPageUrls: string[];
176
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=app_store_developer_data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app_store_developer_data.js","sourceRoot":"","sources":["../../src/models/app_store_developer_data.ts"],"names":[],"mappings":""}