@open-mercato/gateway-tpay 0.10.1-develop.8231.1.ae76b1d2c5 → 0.10.1-develop.8258.1.62a94b74a2

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.
@@ -1,26 +1,9 @@
1
+ import { parseModuleCliOptions } from "@open-mercato/shared/lib/cli/parseModuleCliOptions";
1
2
  import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
2
3
  import { getTelemetryRuntime } from "@open-mercato/shared/lib/telemetry/runtime";
3
4
  import { applyTpayEnvPreset, readTpayEnvPreset } from "./lib/preset.js";
4
5
  function parseArgs(args) {
5
- const result = {};
6
- for (let i = 0; i < args.length; i++) {
7
- const arg = args[i];
8
- if (!arg.startsWith("--")) continue;
9
- const key = arg.slice(2);
10
- if (key.includes("=")) {
11
- const [name, value] = key.split("=");
12
- result[name] = value;
13
- continue;
14
- }
15
- const next = args[i + 1];
16
- if (next && !next.startsWith("--")) {
17
- result[key] = next;
18
- i += 1;
19
- continue;
20
- }
21
- result[key] = true;
22
- }
23
- return result;
6
+ return parseModuleCliOptions(args);
24
7
  }
25
8
  function printHelp() {
26
9
  console.log("Usage: yarn mercato gateway_tpay configure-from-env --tenant <tenantId> --org <organizationId> [--force]");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/modules/gateway_tpay/cli.ts"],
4
- "sourcesContent": ["import { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport type { ModuleCli } from '@open-mercato/shared/modules/registry'\nimport type { CredentialsService } from '@open-mercato/core/modules/integrations/lib/credentials-service'\nimport type { IntegrationLogService } from '@open-mercato/core/modules/integrations/lib/log-service'\nimport type { IntegrationStateService } from '@open-mercato/core/modules/integrations/lib/state-service'\nimport { getTelemetryRuntime } from '@open-mercato/shared/lib/telemetry/runtime'\nimport { applyTpayEnvPreset, readTpayEnvPreset } from './lib/preset'\n\nfunction parseArgs(args: string[]): Record<string, string | boolean> {\n const result: Record<string, string | boolean> = {}\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]\n if (!arg.startsWith('--')) continue\n\n const key = arg.slice(2)\n if (key.includes('=')) {\n const [name, value] = key.split('=')\n result[name] = value\n continue\n }\n\n const next = args[i + 1]\n if (next && !next.startsWith('--')) {\n result[key] = next\n i += 1\n continue\n }\n\n result[key] = true\n }\n\n return result\n}\n\nfunction printHelp(): void {\n console.log('Usage: yarn mercato gateway_tpay configure-from-env --tenant <tenantId> --org <organizationId> [--force]')\n console.log('')\n console.log('Required env vars:')\n console.log(' OM_INTEGRATION_TPAY_CLIENT_ID')\n console.log(' OM_INTEGRATION_TPAY_CLIENT_SECRET')\n console.log('')\n console.log('Optional env vars:')\n console.log(' OM_INTEGRATION_TPAY_ENVIRONMENT (sandbox|production, default sandbox)')\n console.log(' OM_INTEGRATION_TPAY_NOTIFICATION_URL')\n console.log(' OM_INTEGRATION_TPAY_NOTIFICATION_SECURITY_CODE')\n console.log(' OM_INTEGRATION_TPAY_ENABLED')\n console.log(' OM_INTEGRATION_TPAY_FORCE_PRECONFIGURE')\n}\n\nconst configureFromEnvCommand: ModuleCli = {\n command: 'configure-from-env',\n async run(rest) {\n const args = parseArgs(rest)\n const tenantId = String(args.tenantId ?? args.tenant ?? '')\n const organizationId = String(args.organizationId ?? args.orgId ?? args.org ?? '')\n const force = args.force === true\n\n if (!tenantId || !organizationId) {\n printHelp()\n return\n }\n\n let preset: Awaited<ReturnType<typeof readTpayEnvPreset>>\n try {\n preset = await readTpayEnvPreset()\n } catch (error) {\n getTelemetryRuntime()?.reportError(error, { module: 'gateway_tpay', code: 'gateway_tpay.preset_failed' })\n const message = error instanceof Error ? error.message : 'Unknown Tpay preset error'\n console.error(`[gateway_tpay] ${message}`)\n process.exitCode = 1\n return\n }\n if (!preset) {\n console.error('[gateway_tpay] No Tpay env preset was found.')\n printHelp()\n process.exitCode = 1\n return\n }\n\n const container = await createRequestContainer()\n try {\n const credentialsService = container.resolve('integrationCredentialsService') as CredentialsService\n const integrationStateService = container.resolve('integrationStateService') as IntegrationStateService\n const integrationLogService = container.resolve('integrationLogService') as IntegrationLogService\n\n const result = await applyTpayEnvPreset({\n credentialsService,\n integrationStateService,\n integrationLogService,\n scope: { tenantId, organizationId },\n force,\n })\n\n if (result.status === 'skipped') {\n console.log(`[gateway_tpay] Skipped: ${result.reason}`)\n return\n }\n\n console.log(\n `[gateway_tpay] Tpay credentials were configured from env. enabled=${String(result.enabled)} apiVersion=${result.appliedApiVersion ?? 'default'}`,\n )\n } catch (error) {\n getTelemetryRuntime()?.reportError(error, { module: 'gateway_tpay', code: 'gateway_tpay.preset_failed' })\n const message = error instanceof Error ? error.message : 'Unknown Tpay preset error'\n console.error(`[gateway_tpay] ${message}`)\n process.exitCode = 1\n } finally {\n const disposable = container as unknown as { dispose?: () => Promise<void> }\n if (typeof disposable.dispose === 'function') {\n await disposable.dispose()\n }\n }\n },\n}\n\nconst helpCommand: ModuleCli = {\n command: 'help',\n async run() {\n printHelp()\n },\n}\n\nexport default [configureFromEnvCommand, helpCommand]\n"],
5
- "mappings": "AAAA,SAAS,8BAA8B;AAKvC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB,yBAAyB;AAEtD,SAAS,UAAU,MAAkD;AACnE,QAAM,SAA2C,CAAC;AAElD,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,MAAM,KAAK,CAAC;AAClB,QAAI,CAAC,IAAI,WAAW,IAAI,EAAG;AAE3B,UAAM,MAAM,IAAI,MAAM,CAAC;AACvB,QAAI,IAAI,SAAS,GAAG,GAAG;AACrB,YAAM,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,GAAG;AACnC,aAAO,IAAI,IAAI;AACf;AAAA,IACF;AAEA,UAAM,OAAO,KAAK,IAAI,CAAC;AACvB,QAAI,QAAQ,CAAC,KAAK,WAAW,IAAI,GAAG;AAClC,aAAO,GAAG,IAAI;AACd,WAAK;AACL;AAAA,IACF;AAEA,WAA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wBAAwB,UAAU,QAAQ,uBAAuB;AAEvE,YAAM,SAAS,MAAM,mBAAmB;AAAA,QACtC;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,EAAE,UAAU,eAAe;AAAA,QAClC;AAAA,MACF,CAAC;AAED,UAAI,OAAO,WAAW,WAAW;AAC/B,gBAAQ,IAAI,2BAA2B,OAAO,MAAM,EAAE;AACtD;AAAA,MACF;AAEA,cAAQ;AAAA,QACN,qEAAqE,OAAO,OAAO,OAAO,CAAC,eAAe,OAAO,qBAAqB,SAAS;AAAA,MACjJ;AAAA,IACF,SAAS,OAAO;AACd,0BAAoB,GAAG,YAAY,OAAO,EAAE,QAAQ,gBAAgB,MAAM,6BAA6B,CAAC;AACxG,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,cAAQ,MAAM,kBAAkB,OAAO,EAAE;AACzC,cAAQ,WAAW;AAAA,IACrB,UAAE;AACA,YAAM,aAAa;AACnB,UAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,cAAM,WAAW,QAAQ;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,cAAyB;AAAA,EAC7B,SAAS;AAAA,EACT,MAAM,MAAM;AACV,cAAU;AAAA,EACZ;AACF;AAEA,IAAO,cAAQ,CAAC,yBAAyB,WAAW;",
4
+ "sourcesContent": ["import { parseModuleCliOptions } from '@open-mercato/shared/lib/cli/parseModuleCliOptions'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport type { ModuleCli } from '@open-mercato/shared/modules/registry'\nimport type { CredentialsService } from '@open-mercato/core/modules/integrations/lib/credentials-service'\nimport type { IntegrationLogService } from '@open-mercato/core/modules/integrations/lib/log-service'\nimport type { IntegrationStateService } from '@open-mercato/core/modules/integrations/lib/state-service'\nimport { getTelemetryRuntime } from '@open-mercato/shared/lib/telemetry/runtime'\nimport { applyTpayEnvPreset, readTpayEnvPreset } from './lib/preset'\n\nfunction parseArgs(args: string[]): Record<string, string | boolean> {\n return parseModuleCliOptions(args)\n}\n\nfunction printHelp(): void {\n console.log('Usage: yarn mercato gateway_tpay configure-from-env --tenant <tenantId> --org <organizationId> [--force]')\n console.log('')\n console.log('Required env vars:')\n console.log(' OM_INTEGRATION_TPAY_CLIENT_ID')\n console.log(' OM_INTEGRATION_TPAY_CLIENT_SECRET')\n console.log('')\n console.log('Optional env vars:')\n console.log(' OM_INTEGRATION_TPAY_ENVIRONMENT (sandbox|production, default sandbox)')\n console.log(' OM_INTEGRATION_TPAY_NOTIFICATION_URL')\n console.log(' OM_INTEGRATION_TPAY_NOTIFICATION_SECURITY_CODE')\n console.log(' OM_INTEGRATION_TPAY_ENABLED')\n console.log(' OM_INTEGRATION_TPAY_FORCE_PRECONFIGURE')\n}\n\nconst configureFromEnvCommand: ModuleCli = {\n command: 'configure-from-env',\n async run(rest) {\n const args = parseArgs(rest)\n const tenantId = String(args.tenantId ?? args.tenant ?? '')\n const organizationId = String(args.organizationId ?? args.orgId ?? args.org ?? '')\n const force = args.force === true\n\n if (!tenantId || !organizationId) {\n printHelp()\n return\n }\n\n let preset: Awaited<ReturnType<typeof readTpayEnvPreset>>\n try {\n preset = await readTpayEnvPreset()\n } catch (error) {\n getTelemetryRuntime()?.reportError(error, { module: 'gateway_tpay', code: 'gateway_tpay.preset_failed' })\n const message = error instanceof Error ? error.message : 'Unknown Tpay preset error'\n console.error(`[gateway_tpay] ${message}`)\n process.exitCode = 1\n return\n }\n if (!preset) {\n console.error('[gateway_tpay] No Tpay env preset was found.')\n printHelp()\n process.exitCode = 1\n return\n }\n\n const container = await createRequestContainer()\n try {\n const credentialsService = container.resolve('integrationCredentialsService') as CredentialsService\n const integrationStateService = container.resolve('integrationStateService') as IntegrationStateService\n const integrationLogService = container.resolve('integrationLogService') as IntegrationLogService\n\n const result = await applyTpayEnvPreset({\n credentialsService,\n integrationStateService,\n integrationLogService,\n scope: { tenantId, organizationId },\n force,\n })\n\n if (result.status === 'skipped') {\n console.log(`[gateway_tpay] Skipped: ${result.reason}`)\n return\n }\n\n console.log(\n `[gateway_tpay] Tpay credentials were configured from env. enabled=${String(result.enabled)} apiVersion=${result.appliedApiVersion ?? 'default'}`,\n )\n } catch (error) {\n getTelemetryRuntime()?.reportError(error, { module: 'gateway_tpay', code: 'gateway_tpay.preset_failed' })\n const message = error instanceof Error ? error.message : 'Unknown Tpay preset error'\n console.error(`[gateway_tpay] ${message}`)\n process.exitCode = 1\n } finally {\n const disposable = container as unknown as { dispose?: () => Promise<void> }\n if (typeof disposable.dispose === 'function') {\n await disposable.dispose()\n }\n }\n },\n}\n\nconst helpCommand: ModuleCli = {\n command: 'help',\n async run() {\n printHelp()\n },\n}\n\nexport default [configureFromEnvCommand, helpCommand]\n"],
5
+ "mappings": "AAAA,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AAKvC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB,yBAAyB;AAEtD,SAAS,UAAU,MAAkD;AACnE,SAAO,sBAAsB,IAAI;AACnC;AAEA,SAAS,YAAkB;AACzB,UAAQ,IAAI,0GAA0G;AACtH,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,oBAAoB;AAChC,UAAQ,IAAI,iCAAiC;AAC7C,UAAQ,IAAI,qCAAqC;AACjD,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,oBAAoB;AAChC,UAAQ,IAAI,yEAAyE;AACrF,UAAQ,IAAI,wCAAwC;AACpD,UAAQ,IAAI,kDAAkD;AAC9D,UAAQ,IAAI,+BAA+B;AAC3C,UAAQ,IAAI,0CAA0C;AACxD;AAEA,MAAM,0BAAqC;AAAA,EACzC,SAAS;AAAA,EACT,MAAM,IAAI,MAAM;AACd,UAAM,OAAO,UAAU,IAAI;AAC3B,UAAM,WAAW,OAAO,KAAK,YAAY,KAAK,UAAU,EAAE;AAC1D,UAAM,iBAAiB,OAAO,KAAK,kBAAkB,KAAK,SAAS,KAAK,OAAO,EAAE;AACjF,UAAM,QAAQ,KAAK,UAAU;AAE7B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C3B;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,cAAyB;AAAA,EAC7B,SAAS;AAAA,EACT,MAAM,MAAM;AACV,cAAU;AAAA,EACZ;AACF;AAEA,IAAO,cAAQ,CAAC,yBAAyB,WAAW;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/gateway-tpay",
3
- "version": "0.10.1-develop.8231.1.ae76b1d2c5",
3
+ "version": "0.10.1-develop.8258.1.62a94b74a2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -62,21 +62,21 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@open-mercato/core": "0.10.1-develop.8231.1.ae76b1d2c5",
65
+ "@open-mercato/core": "0.10.1-develop.8258.1.62a94b74a2",
66
66
  "zod": "^4.6.6"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@mikro-orm/postgresql": "^7.0.14",
70
- "@open-mercato/ai-assistant": "0.10.1-develop.8231.1.ae76b1d2c5",
71
- "@open-mercato/shared": "0.10.1-develop.8231.1.ae76b1d2c5",
72
- "@open-mercato/ui": "0.10.1-develop.8231.1.ae76b1d2c5",
70
+ "@open-mercato/ai-assistant": "0.10.1-develop.8258.1.62a94b74a2",
71
+ "@open-mercato/shared": "0.10.1-develop.8258.1.62a94b74a2",
72
+ "@open-mercato/ui": "0.10.1-develop.8258.1.62a94b74a2",
73
73
  "react": "^19.0.0",
74
74
  "react-dom": "^19.0.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@open-mercato/ai-assistant": "0.10.1-develop.8231.1.ae76b1d2c5",
78
- "@open-mercato/shared": "0.10.1-develop.8231.1.ae76b1d2c5",
79
- "@open-mercato/ui": "0.10.1-develop.8231.1.ae76b1d2c5",
77
+ "@open-mercato/ai-assistant": "0.10.1-develop.8258.1.62a94b74a2",
78
+ "@open-mercato/shared": "0.10.1-develop.8258.1.62a94b74a2",
79
+ "@open-mercato/ui": "0.10.1-develop.8258.1.62a94b74a2",
80
80
  "@types/jest": "^30.0.0",
81
81
  "esbuild": "^0.28.2",
82
82
  "glob": "^14.0.6",
@@ -1,3 +1,4 @@
1
+ import { parseModuleCliOptions } from '@open-mercato/shared/lib/cli/parseModuleCliOptions'
1
2
  import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
2
3
  import type { ModuleCli } from '@open-mercato/shared/modules/registry'
3
4
  import type { CredentialsService } from '@open-mercato/core/modules/integrations/lib/credentials-service'
@@ -7,30 +8,7 @@ import { getTelemetryRuntime } from '@open-mercato/shared/lib/telemetry/runtime'
7
8
  import { applyTpayEnvPreset, readTpayEnvPreset } from './lib/preset'
8
9
 
9
10
  function parseArgs(args: string[]): Record<string, string | boolean> {
10
- const result: Record<string, string | boolean> = {}
11
-
12
- for (let i = 0; i < args.length; i++) {
13
- const arg = args[i]
14
- if (!arg.startsWith('--')) continue
15
-
16
- const key = arg.slice(2)
17
- if (key.includes('=')) {
18
- const [name, value] = key.split('=')
19
- result[name] = value
20
- continue
21
- }
22
-
23
- const next = args[i + 1]
24
- if (next && !next.startsWith('--')) {
25
- result[key] = next
26
- i += 1
27
- continue
28
- }
29
-
30
- result[key] = true
31
- }
32
-
33
- return result
11
+ return parseModuleCliOptions(args)
34
12
  }
35
13
 
36
14
  function printHelp(): void {