@open-mercato/gus-regon 0.11.1-develop.9114.1.e26ee64834 → 0.11.1-develop.9121.1.1b6d34f5d8

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,4 +1,7 @@
1
1
  import { parseBooleanToken } from "@open-mercato/shared/lib/boolean";
2
+ import {
3
+ inspectStoredCredentials
4
+ } from "@open-mercato/core/modules/integrations/lib/credentials-service";
2
5
  import { GUS_REGON_INTEGRATION_ID } from "./config.js";
3
6
  const ENV_KEYS = {
4
7
  apiKey: "OM_INTEGRATION_GUS_REGON_API_KEY",
@@ -32,10 +35,10 @@ function readGusRegonEnvPreset(env = process.env) {
32
35
  }
33
36
  async function hasExistingConfiguration(credentialsService, integrationStateService, scope) {
34
37
  const [credentials, state] = await Promise.all([
35
- credentialsService.getRaw(GUS_REGON_INTEGRATION_ID, scope),
38
+ inspectStoredCredentials(credentialsService, GUS_REGON_INTEGRATION_ID, scope, { via: "getRaw" }),
36
39
  integrationStateService.get(GUS_REGON_INTEGRATION_ID, scope)
37
40
  ]);
38
- return Boolean(credentials) || Boolean(state);
41
+ return credentials.state !== "absent" || Boolean(state);
39
42
  }
40
43
  async function applyGusRegonEnvPreset(params) {
41
44
  const preset = readGusRegonEnvPreset(params.env);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/gus_regon/lib/preset.ts"],
4
- "sourcesContent": ["import { parseBooleanToken } from '@open-mercato/shared/lib/boolean'\nimport type { IntegrationScope } from '@open-mercato/shared/modules/integrations/types'\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 { GUS_REGON_INTEGRATION_ID } from './config'\nimport type { GusEnvironment } from './types'\n\nconst ENV_KEYS = {\n apiKey: 'OM_INTEGRATION_GUS_REGON_API_KEY',\n environment: 'OM_INTEGRATION_GUS_REGON_ENVIRONMENT',\n showOnCompanyForms: 'OM_INTEGRATION_GUS_REGON_SHOW_ON_COMPANY_FORMS',\n enabled: 'OM_INTEGRATION_GUS_REGON_ENABLED',\n force: 'OM_INTEGRATION_GUS_REGON_FORCE_PRECONFIGURE',\n} as const\n\nexport type GusRegonEnvPreset = {\n credentials: {\n environment: GusEnvironment\n apiKey: string\n showOnCompanyForms: boolean\n }\n force: boolean\n enabled: boolean\n}\n\nexport type ApplyGusRegonPresetResult =\n | { status: 'skipped'; reason: string }\n | { status: 'configured'; enabled: boolean }\n\nfunction readEnvValue(env: NodeJS.ProcessEnv, key: string): string | undefined {\n const value = env[key]?.trim()\n return value ? value : undefined\n}\n\nfunction readEnvironment(env: NodeJS.ProcessEnv): GusEnvironment {\n const raw = readEnvValue(env, ENV_KEYS.environment)\n if (raw === undefined) return 'test'\n if (raw === 'test' || raw === 'production') return raw\n throw new Error(`[internal] [gus_regon] ${ENV_KEYS.environment} must be \"test\" or \"production\".`)\n}\n\n/**\n * Reads the provider preset from env. The API key is the trigger: without it\n * nothing is preconfigured, so a deployment opts in explicitly.\n */\nexport function readGusRegonEnvPreset(env: NodeJS.ProcessEnv = process.env): GusRegonEnvPreset | null {\n const apiKey = readEnvValue(env, ENV_KEYS.apiKey)\n if (!apiKey) return null\n\n return {\n credentials: {\n environment: readEnvironment(env),\n apiKey,\n showOnCompanyForms: parseBooleanToken(env[ENV_KEYS.showOnCompanyForms]) ?? false,\n },\n force: parseBooleanToken(env[ENV_KEYS.force]) ?? false,\n enabled: parseBooleanToken(env[ENV_KEYS.enabled]) ?? true,\n }\n}\n\nasync function hasExistingConfiguration(\n credentialsService: CredentialsService,\n integrationStateService: IntegrationStateService,\n scope: IntegrationScope,\n): Promise<boolean> {\n const [credentials, state] = await Promise.all([\n credentialsService.getRaw(GUS_REGON_INTEGRATION_ID, scope),\n integrationStateService.get(GUS_REGON_INTEGRATION_ID, scope),\n ])\n return Boolean(credentials) || Boolean(state)\n}\n\nexport async function applyGusRegonEnvPreset(params: {\n credentialsService: CredentialsService\n integrationStateService: IntegrationStateService\n integrationLogService?: IntegrationLogService\n scope: IntegrationScope\n force?: boolean\n env?: NodeJS.ProcessEnv\n}): Promise<ApplyGusRegonPresetResult> {\n const preset = readGusRegonEnvPreset(params.env)\n if (!preset) {\n return { status: 'skipped', reason: 'No GUS REGON preset env variables were provided.' }\n }\n\n const force = params.force ?? preset.force\n if (!force && await hasExistingConfiguration(params.credentialsService, params.integrationStateService, params.scope)) {\n return { status: 'skipped', reason: 'GUS REGON credentials or state already exist. Use force to overwrite them.' }\n }\n\n await params.credentialsService.save(GUS_REGON_INTEGRATION_ID, preset.credentials, params.scope)\n await params.integrationStateService.upsert(GUS_REGON_INTEGRATION_ID, { isEnabled: preset.enabled }, params.scope)\n\n if (params.integrationLogService) {\n await params.integrationLogService.scoped(GUS_REGON_INTEGRATION_ID, params.scope).info(\n 'GUS REGON integration was preconfigured from environment variables.',\n {\n enabled: preset.enabled,\n environment: preset.credentials.environment,\n showOnCompanyForms: preset.credentials.showOnCompanyForms,\n },\n )\n }\n\n return { status: 'configured', enabled: preset.enabled }\n}\n"],
5
- "mappings": "AAAA,SAAS,yBAAyB;AAKlC,SAAS,gCAAgC;AAGzC,MAAM,WAAW;AAAA,EACf,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,OAAO;AACT;AAgBA,SAAS,aAAa,KAAwB,KAAiC;AAC7E,QAAM,QAAQ,IAAI,GAAG,GAAG,KAAK;AAC7B,SAAO,QAAQ,QAAQ;AACzB;AAEA,SAAS,gBAAgB,KAAwC;AAC/D,QAAM,MAAM,aAAa,KAAK,SAAS,WAAW;AAClD,MAAI,QAAQ,OAAW,QAAO;AAC9B,MAAI,QAAQ,UAAU,QAAQ,aAAc,QAAO;AACnD,QAAM,IAAI,MAAM,0BAA0B,SAAS,WAAW,kCAAkC;AACl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A,QACE,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO,YAAY;AAAA,QAChC,oBAAoB,OAAO,YAAY;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ,cAAc,SAAS,OAAO,QAAQ;AACzD;",
4
+ "sourcesContent": ["import { parseBooleanToken } from '@open-mercato/shared/lib/boolean'\nimport type { IntegrationScope } from '@open-mercato/shared/modules/integrations/types'\nimport {\n inspectStoredCredentials,\n type CredentialsService,\n} 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 { GUS_REGON_INTEGRATION_ID } from './config'\nimport type { GusEnvironment } from './types'\n\nconst ENV_KEYS = {\n apiKey: 'OM_INTEGRATION_GUS_REGON_API_KEY',\n environment: 'OM_INTEGRATION_GUS_REGON_ENVIRONMENT',\n showOnCompanyForms: 'OM_INTEGRATION_GUS_REGON_SHOW_ON_COMPANY_FORMS',\n enabled: 'OM_INTEGRATION_GUS_REGON_ENABLED',\n force: 'OM_INTEGRATION_GUS_REGON_FORCE_PRECONFIGURE',\n} as const\n\nexport type GusRegonEnvPreset = {\n credentials: {\n environment: GusEnvironment\n apiKey: string\n showOnCompanyForms: boolean\n }\n force: boolean\n enabled: boolean\n}\n\nexport type ApplyGusRegonPresetResult =\n | { status: 'skipped'; reason: string }\n | { status: 'configured'; enabled: boolean }\n\nfunction readEnvValue(env: NodeJS.ProcessEnv, key: string): string | undefined {\n const value = env[key]?.trim()\n return value ? value : undefined\n}\n\nfunction readEnvironment(env: NodeJS.ProcessEnv): GusEnvironment {\n const raw = readEnvValue(env, ENV_KEYS.environment)\n if (raw === undefined) return 'test'\n if (raw === 'test' || raw === 'production') return raw\n throw new Error(`[internal] [gus_regon] ${ENV_KEYS.environment} must be \"test\" or \"production\".`)\n}\n\n/**\n * Reads the provider preset from env. The API key is the trigger: without it\n * nothing is preconfigured, so a deployment opts in explicitly.\n */\nexport function readGusRegonEnvPreset(env: NodeJS.ProcessEnv = process.env): GusRegonEnvPreset | null {\n const apiKey = readEnvValue(env, ENV_KEYS.apiKey)\n if (!apiKey) return null\n\n return {\n credentials: {\n environment: readEnvironment(env),\n apiKey,\n showOnCompanyForms: parseBooleanToken(env[ENV_KEYS.showOnCompanyForms]) ?? false,\n },\n force: parseBooleanToken(env[ENV_KEYS.force]) ?? false,\n enabled: parseBooleanToken(env[ENV_KEYS.enabled]) ?? true,\n }\n}\n\nasync function hasExistingConfiguration(\n credentialsService: CredentialsService,\n integrationStateService: IntegrationStateService,\n scope: IntegrationScope,\n): Promise<boolean> {\n const [credentials, state] = await Promise.all([\n inspectStoredCredentials(credentialsService, GUS_REGON_INTEGRATION_ID, scope, { via: 'getRaw' }),\n integrationStateService.get(GUS_REGON_INTEGRATION_ID, scope),\n ])\n return credentials.state !== 'absent' || Boolean(state)\n}\n\nexport async function applyGusRegonEnvPreset(params: {\n credentialsService: CredentialsService\n integrationStateService: IntegrationStateService\n integrationLogService?: IntegrationLogService\n scope: IntegrationScope\n force?: boolean\n env?: NodeJS.ProcessEnv\n}): Promise<ApplyGusRegonPresetResult> {\n const preset = readGusRegonEnvPreset(params.env)\n if (!preset) {\n return { status: 'skipped', reason: 'No GUS REGON preset env variables were provided.' }\n }\n\n const force = params.force ?? preset.force\n if (!force && await hasExistingConfiguration(params.credentialsService, params.integrationStateService, params.scope)) {\n return { status: 'skipped', reason: 'GUS REGON credentials or state already exist. Use force to overwrite them.' }\n }\n\n await params.credentialsService.save(GUS_REGON_INTEGRATION_ID, preset.credentials, params.scope)\n await params.integrationStateService.upsert(GUS_REGON_INTEGRATION_ID, { isEnabled: preset.enabled }, params.scope)\n\n if (params.integrationLogService) {\n await params.integrationLogService.scoped(GUS_REGON_INTEGRATION_ID, params.scope).info(\n 'GUS REGON integration was preconfigured from environment variables.',\n {\n enabled: preset.enabled,\n environment: preset.credentials.environment,\n showOn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,QAAQ,KAAK;AACxD;AAEA,eAAsB,uBAAuB,QAON;AACrC,QAAM,SAAS,sBAAsB,OAAO,GAAG;AAC/C,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,QAAQ,WAAW,QAAQ,mDAAmD;AAAA,EACzF;AAEA,QAAM,QAAQ,OAAO,SAAS,OAAO;AACrC,MAAI,CAAC,SAAS,MAAM,yBAAyB,OAAO,oBAAoB,OAAO,yBAAyB,OAAO,KAAK,GAAG;AACrH,WAAO,EAAE,QAAQ,WAAW,QAAQ,6EAA6E;AAAA,EACnH;AAEA,QAAM,OAAO,mBAAmB,KAAK,0BAA0B,OAAO,aAAa,OAAO,KAAK;AAC/F,QAAM,OAAO,wBAAwB,OAAO,0BAA0B,EAAE,WAAW,OAAO,QAAQ,GAAG,OAAO,KAAK;AAEjH,MAAI,OAAO,uBAAuB;AAChC,UAAM,OAAO,sBAAsB,OAAO,0BAA0B,OAAO,KAAK,EAAE;AAAA,MAChF;AAAA,MACA;AAAA,QACE,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO,YAAY;AAAA,QAChC,oBAAoB,OAAO,YAAY;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ,cAAc,SAAS,OAAO,QAAQ;AACzD;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/gus-regon",
3
- "version": "0.11.1-develop.9114.1.e26ee64834",
3
+ "version": "0.11.1-develop.9121.1.1b6d34f5d8",
4
4
  "license": "MIT",
5
5
  "description": "GUS REGON (BIR1) company lookup for Open Mercato — autofill Polish company name and registered address by NIP.",
6
6
  "type": "module",
@@ -63,21 +63,21 @@
63
63
  }
64
64
  },
65
65
  "dependencies": {
66
- "@open-mercato/core": "0.11.1-develop.9114.1.e26ee64834",
67
- "@open-mercato/ui": "0.11.1-develop.9114.1.e26ee64834",
66
+ "@open-mercato/core": "0.11.1-develop.9121.1.1b6d34f5d8",
67
+ "@open-mercato/ui": "0.11.1-develop.9121.1.1b6d34f5d8",
68
68
  "fast-xml-parser": "^5.12.1",
69
69
  "zod": "^4.4.3"
70
70
  },
71
71
  "peerDependencies": {
72
- "@open-mercato/ai-assistant": "0.11.1-develop.9114.1.e26ee64834",
73
- "@open-mercato/shared": "0.11.1-develop.9114.1.e26ee64834",
72
+ "@open-mercato/ai-assistant": "0.11.1-develop.9121.1.1b6d34f5d8",
73
+ "@open-mercato/shared": "0.11.1-develop.9121.1.1b6d34f5d8",
74
74
  "react": "^19.0.0",
75
75
  "react-dom": "^19.0.0",
76
76
  "react-is": ">=18.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@open-mercato/ai-assistant": "0.11.1-develop.9114.1.e26ee64834",
80
- "@open-mercato/shared": "0.11.1-develop.9114.1.e26ee64834",
79
+ "@open-mercato/ai-assistant": "0.11.1-develop.9121.1.1b6d34f5d8",
80
+ "@open-mercato/shared": "0.11.1-develop.9121.1.1b6d34f5d8",
81
81
  "@types/jest": "^30.0.0",
82
82
  "@types/react": "^19.2.18",
83
83
  "@types/react-dom": "^19.2.5",
@@ -0,0 +1,59 @@
1
+ import {
2
+ CredentialsEncryptionUnavailableError,
3
+ type CredentialsService,
4
+ } from '@open-mercato/core/modules/integrations/lib/credentials-service'
5
+ import type { IntegrationStateService } from '@open-mercato/core/modules/integrations/lib/state-service'
6
+ import { applyGusRegonEnvPreset } from '../lib/preset'
7
+
8
+ describe('gus_regon preset over stored credentials it cannot read (D19/D23)', () => {
9
+ const scope = { tenantId: 'tenant-1', organizationId: 'org-1' }
10
+ const env = {
11
+ OM_INTEGRATION_GUS_REGON_API_KEY: 'gus-preset-key-123',
12
+ }
13
+
14
+ function services(reason: 'undecryptable' | 'no-dek') {
15
+ const save = jest.fn(async () => undefined)
16
+ const getRaw = jest.fn().mockRejectedValue(new CredentialsEncryptionUnavailableError(scope.tenantId, reason))
17
+ return {
18
+ save,
19
+ getRaw,
20
+ params: {
21
+ credentialsService: { getRaw, save } as unknown as CredentialsService,
22
+ integrationStateService: {
23
+ get: jest.fn().mockResolvedValue(null),
24
+ upsert: jest.fn(async (_integrationId: string, input: unknown) => input),
25
+ } as unknown as IntegrationStateService,
26
+ scope,
27
+ env,
28
+ },
29
+ }
30
+ }
31
+
32
+ it('skips without force and leaves a blob no key opens unchanged', async () => {
33
+ const { save, getRaw, params } = services('undecryptable')
34
+
35
+ const result = await applyGusRegonEnvPreset(params)
36
+
37
+ expect(result.status).toBe('skipped')
38
+ expect(getRaw).toHaveBeenCalledWith('gus_regon', scope)
39
+ expect(save).not.toHaveBeenCalled()
40
+ })
41
+
42
+ it('fails without force during a key outage instead of saving over the blob', async () => {
43
+ const { save, params } = services('no-dek')
44
+
45
+ await expect(applyGusRegonEnvPreset(params)).rejects.toBeInstanceOf(CredentialsEncryptionUnavailableError)
46
+ expect(save).not.toHaveBeenCalled()
47
+ })
48
+
49
+ it('replaces the credentials under force without reading them', async () => {
50
+ const { save, getRaw, params } = services('undecryptable')
51
+
52
+ const result = await applyGusRegonEnvPreset({ ...params, force: true })
53
+
54
+ expect(result.status).toBe('configured')
55
+ expect(getRaw).not.toHaveBeenCalled()
56
+ expect(save).toHaveBeenCalledTimes(1)
57
+ expect(save).toHaveBeenCalledWith('gus_regon', expect.any(Object), scope)
58
+ })
59
+ })
@@ -1,6 +1,9 @@
1
1
  import { parseBooleanToken } from '@open-mercato/shared/lib/boolean'
2
2
  import type { IntegrationScope } from '@open-mercato/shared/modules/integrations/types'
3
- import type { CredentialsService } from '@open-mercato/core/modules/integrations/lib/credentials-service'
3
+ import {
4
+ inspectStoredCredentials,
5
+ type CredentialsService,
6
+ } from '@open-mercato/core/modules/integrations/lib/credentials-service'
4
7
  import type { IntegrationLogService } from '@open-mercato/core/modules/integrations/lib/log-service'
5
8
  import type { IntegrationStateService } from '@open-mercato/core/modules/integrations/lib/state-service'
6
9
  import { GUS_REGON_INTEGRATION_ID } from './config'
@@ -65,10 +68,10 @@ async function hasExistingConfiguration(
65
68
  scope: IntegrationScope,
66
69
  ): Promise<boolean> {
67
70
  const [credentials, state] = await Promise.all([
68
- credentialsService.getRaw(GUS_REGON_INTEGRATION_ID, scope),
71
+ inspectStoredCredentials(credentialsService, GUS_REGON_INTEGRATION_ID, scope, { via: 'getRaw' }),
69
72
  integrationStateService.get(GUS_REGON_INTEGRATION_ID, scope),
70
73
  ])
71
- return Boolean(credentials) || Boolean(state)
74
+ return credentials.state !== 'absent' || Boolean(state)
72
75
  }
73
76
 
74
77
  export async function applyGusRegonEnvPreset(params: {