@enfuce/nextgen-sdk 0.0.6 → 0.0.7

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.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Identifies a single Enfuce deployment by its `tenant` and `environment` — the two variable
3
+ * segments of every Enfuce host, e.g. `api.<tenant>.<environment>.mycore.enfuce.com`.
4
+ */
5
+ export interface TenantEnvironment {
6
+ /** Tenant segment, e.g. `swile`, `shine`, `cad`. */
7
+ tenant: string;
8
+ /** Environment segment, e.g. `ext-uat1-sandbox`, `eu.live.prod`. */
9
+ environment: string;
10
+ }
11
+ /** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
12
+ export declare function apiBaseUrl(te: TenantEnvironment): string;
13
+ /** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
14
+ export declare function issuerBaseUrl(te: TenantEnvironment): string;
15
+ /** `.../processor` — processor domain (transactions, 3DS). */
16
+ export declare function processorBaseUrl(te: TenantEnvironment): string;
17
+ /** `.../exchange-rates-api` — exchange-rate domain. */
18
+ export declare function exchangeRateBaseUrl(te: TenantEnvironment): string;
19
+ /** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
20
+ export declare function tokenUrl(te: TenantEnvironment): string;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /*
3
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
4
+ *
5
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
6
+ * preserved across SDK regeneration (see scripts/generate.sh). Do not expect
7
+ * OpenAPI Generator to (re)produce it.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.apiBaseUrl = apiBaseUrl;
11
+ exports.issuerBaseUrl = issuerBaseUrl;
12
+ exports.processorBaseUrl = processorBaseUrl;
13
+ exports.exchangeRateBaseUrl = exchangeRateBaseUrl;
14
+ exports.tokenUrl = tokenUrl;
15
+ const DOMAIN_SUFFIX = 'mycore.enfuce.com';
16
+ function hostSuffix(te) {
17
+ var _a, _b;
18
+ const tenant = (_a = te === null || te === void 0 ? void 0 : te.tenant) === null || _a === void 0 ? void 0 : _a.trim();
19
+ const environment = (_b = te === null || te === void 0 ? void 0 : te.environment) === null || _b === void 0 ? void 0 : _b.trim();
20
+ if (!tenant) {
21
+ throw new Error('tenant must not be empty');
22
+ }
23
+ if (!environment) {
24
+ throw new Error('environment must not be empty');
25
+ }
26
+ return `${tenant}.${environment}.${DOMAIN_SUFFIX}`;
27
+ }
28
+ /** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
29
+ function apiBaseUrl(te) {
30
+ return `https://api.${hostSuffix(te)}`;
31
+ }
32
+ /** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
33
+ function issuerBaseUrl(te) {
34
+ return `${apiBaseUrl(te)}/issuer`;
35
+ }
36
+ /** `.../processor` — processor domain (transactions, 3DS). */
37
+ function processorBaseUrl(te) {
38
+ return `${apiBaseUrl(te)}/processor`;
39
+ }
40
+ /** `.../exchange-rates-api` — exchange-rate domain. */
41
+ function exchangeRateBaseUrl(te) {
42
+ return `${apiBaseUrl(te)}/exchange-rates-api`;
43
+ }
44
+ /** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
45
+ function tokenUrl(te) {
46
+ return `https://auth.${hostSuffix(te)}/oauth2/token`;
47
+ }
@@ -0,0 +1 @@
1
+ export { TenantEnvironment, apiBaseUrl, issuerBaseUrl, processorBaseUrl, exchangeRateBaseUrl, tokenUrl, } from './enfuceUrls';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tokenUrl = exports.exchangeRateBaseUrl = exports.processorBaseUrl = exports.issuerBaseUrl = exports.apiBaseUrl = void 0;
4
+ /*
5
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
6
+ *
7
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
8
+ * preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
9
+ * from the package barrel as `config`:
10
+ *
11
+ * import { config, cardholder, oauth } from '@enfuce/nextgen-sdk';
12
+ *
13
+ * const te = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
14
+ * const conf = new cardholder.Configuration({ basePath: config.issuerBaseUrl(te) });
15
+ * const tokens = oauth.clientCredentials({ tokenUrl: config.tokenUrl(te), clientId, clientSecret });
16
+ */
17
+ var enfuceUrls_1 = require("./enfuceUrls");
18
+ Object.defineProperty(exports, "apiBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.apiBaseUrl; } });
19
+ Object.defineProperty(exports, "issuerBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.issuerBaseUrl; } });
20
+ Object.defineProperty(exports, "processorBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.processorBaseUrl; } });
21
+ Object.defineProperty(exports, "exchangeRateBaseUrl", { enumerable: true, get: function () { return enfuceUrls_1.exchangeRateBaseUrl; } });
22
+ Object.defineProperty(exports, "tokenUrl", { enumerable: true, get: function () { return enfuceUrls_1.tokenUrl; } });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Identifies a single Enfuce deployment by its `tenant` and `environment` — the two variable
3
+ * segments of every Enfuce host, e.g. `api.<tenant>.<environment>.mycore.enfuce.com`.
4
+ */
5
+ export interface TenantEnvironment {
6
+ /** Tenant segment, e.g. `swile`, `shine`, `cad`. */
7
+ tenant: string;
8
+ /** Environment segment, e.g. `ext-uat1-sandbox`, `eu.live.prod`. */
9
+ environment: string;
10
+ }
11
+ /** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
12
+ export declare function apiBaseUrl(te: TenantEnvironment): string;
13
+ /** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
14
+ export declare function issuerBaseUrl(te: TenantEnvironment): string;
15
+ /** `.../processor` — processor domain (transactions, 3DS). */
16
+ export declare function processorBaseUrl(te: TenantEnvironment): string;
17
+ /** `.../exchange-rates-api` — exchange-rate domain. */
18
+ export declare function exchangeRateBaseUrl(te: TenantEnvironment): string;
19
+ /** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
20
+ export declare function tokenUrl(te: TenantEnvironment): string;
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). Do not expect
6
+ * OpenAPI Generator to (re)produce it.
7
+ */
8
+ const DOMAIN_SUFFIX = 'mycore.enfuce.com';
9
+ function hostSuffix(te) {
10
+ var _a, _b;
11
+ const tenant = (_a = te === null || te === void 0 ? void 0 : te.tenant) === null || _a === void 0 ? void 0 : _a.trim();
12
+ const environment = (_b = te === null || te === void 0 ? void 0 : te.environment) === null || _b === void 0 ? void 0 : _b.trim();
13
+ if (!tenant) {
14
+ throw new Error('tenant must not be empty');
15
+ }
16
+ if (!environment) {
17
+ throw new Error('environment must not be empty');
18
+ }
19
+ return `${tenant}.${environment}.${DOMAIN_SUFFIX}`;
20
+ }
21
+ /** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
22
+ export function apiBaseUrl(te) {
23
+ return `https://api.${hostSuffix(te)}`;
24
+ }
25
+ /** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
26
+ export function issuerBaseUrl(te) {
27
+ return `${apiBaseUrl(te)}/issuer`;
28
+ }
29
+ /** `.../processor` — processor domain (transactions, 3DS). */
30
+ export function processorBaseUrl(te) {
31
+ return `${apiBaseUrl(te)}/processor`;
32
+ }
33
+ /** `.../exchange-rates-api` — exchange-rate domain. */
34
+ export function exchangeRateBaseUrl(te) {
35
+ return `${apiBaseUrl(te)}/exchange-rates-api`;
36
+ }
37
+ /** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
38
+ export function tokenUrl(te) {
39
+ return `https://auth.${hostSuffix(te)}/oauth2/token`;
40
+ }
@@ -0,0 +1 @@
1
+ export { TenantEnvironment, apiBaseUrl, issuerBaseUrl, processorBaseUrl, exchangeRateBaseUrl, tokenUrl, } from './enfuceUrls';
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
6
+ * from the package barrel as `config`:
7
+ *
8
+ * import { config, cardholder, oauth } from '@enfuce/nextgen-sdk';
9
+ *
10
+ * const te = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
11
+ * const conf = new cardholder.Configuration({ basePath: config.issuerBaseUrl(te) });
12
+ * const tokens = oauth.clientCredentials({ tokenUrl: config.tokenUrl(te), clientId, clientSecret });
13
+ */
14
+ export { apiBaseUrl, issuerBaseUrl, processorBaseUrl, exchangeRateBaseUrl, tokenUrl, } from './enfuceUrls';
@@ -1,4 +1,5 @@
1
1
  export * as oauth from './oauth';
2
+ export * as config from './config';
2
3
  export * as card from './card';
3
4
  export * as wallet from './wallet';
4
5
  export * as cardholder from './cardholder';
package/dist/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* AUTO-GENERATED by scripts/generate.sh - do not edit. */
2
2
  /* One namespaced export per API. Usage: import { card } from '@enfuce/nextgen-sdk'; */
3
3
  export * as oauth from './oauth';
4
+ export * as config from './config';
4
5
  export * as card from './card';
5
6
  export * as wallet from './wallet';
6
7
  export * as cardholder from './cardholder';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * as oauth from './oauth';
2
+ export * as config from './config';
2
3
  export * as card from './card';
3
4
  export * as wallet from './wallet';
4
5
  export * as cardholder from './cardholder';
package/dist/index.js CHANGED
@@ -2,8 +2,9 @@
2
2
  /* AUTO-GENERATED by scripts/generate.sh - do not edit. */
3
3
  /* One namespaced export per API. Usage: import { card } from '@enfuce/nextgen-sdk'; */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.exchangeRate = exports.transactionEvent = exports.clearingFileCopy = exports.threedsOob = exports.threeds = exports.cards = exports.authorisationControl = exports.issuerEvents = exports.pin = exports.cardholder = exports.wallet = exports.card = exports.oauth = void 0;
5
+ exports.exchangeRate = exports.transactionEvent = exports.clearingFileCopy = exports.threedsOob = exports.threeds = exports.cards = exports.authorisationControl = exports.issuerEvents = exports.pin = exports.cardholder = exports.wallet = exports.card = exports.config = exports.oauth = void 0;
6
6
  exports.oauth = require("./oauth");
7
+ exports.config = require("./config");
7
8
  exports.card = require("./card");
8
9
  exports.wallet = require("./wallet");
9
10
  exports.cardholder = require("./cardholder");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfuce/nextgen-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Enfuce nextgen client SDK (TypeScript). One namespaced export per API.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). Do not expect
6
+ * OpenAPI Generator to (re)produce it.
7
+ */
8
+
9
+ /**
10
+ * Identifies a single Enfuce deployment by its `tenant` and `environment` — the two variable
11
+ * segments of every Enfuce host, e.g. `api.<tenant>.<environment>.mycore.enfuce.com`.
12
+ */
13
+ export interface TenantEnvironment {
14
+ /** Tenant segment, e.g. `swile`, `shine`, `cad`. */
15
+ tenant: string;
16
+ /** Environment segment, e.g. `ext-uat1-sandbox`, `eu.live.prod`. */
17
+ environment: string;
18
+ }
19
+
20
+ const DOMAIN_SUFFIX = 'mycore.enfuce.com';
21
+
22
+ function hostSuffix(te: TenantEnvironment): string {
23
+ const tenant = te?.tenant?.trim();
24
+ const environment = te?.environment?.trim();
25
+ if (!tenant) {
26
+ throw new Error('tenant must not be empty');
27
+ }
28
+ if (!environment) {
29
+ throw new Error('environment must not be empty');
30
+ }
31
+ return `${tenant}.${environment}.${DOMAIN_SUFFIX}`;
32
+ }
33
+
34
+ /** `https://api.<tenant>.<environment>.mycore.enfuce.com` — the API root, no path. */
35
+ export function apiBaseUrl(te: TenantEnvironment): string {
36
+ return `https://api.${hostSuffix(te)}`;
37
+ }
38
+
39
+ /** `.../issuer` — issuer domain (cardholder, card, wallet, pin). */
40
+ export function issuerBaseUrl(te: TenantEnvironment): string {
41
+ return `${apiBaseUrl(te)}/issuer`;
42
+ }
43
+
44
+ /** `.../processor` — processor domain (transactions, 3DS). */
45
+ export function processorBaseUrl(te: TenantEnvironment): string {
46
+ return `${apiBaseUrl(te)}/processor`;
47
+ }
48
+
49
+ /** `.../exchange-rates-api` — exchange-rate domain. */
50
+ export function exchangeRateBaseUrl(te: TenantEnvironment): string {
51
+ return `${apiBaseUrl(te)}/exchange-rates-api`;
52
+ }
53
+
54
+ /** `https://auth.<tenant>.<environment>.mycore.enfuce.com/oauth2/token` — OAuth2 token endpoint. */
55
+ export function tokenUrl(te: TenantEnvironment): string {
56
+ return `https://auth.${hostSuffix(te)}/oauth2/token`;
57
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Enfuce nextgen SDK — tenant/environment addressing helper.
3
+ *
4
+ * HAND-WRITTEN, NOT GENERATED. This module (src/config) is authored by hand and
5
+ * preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
6
+ * from the package barrel as `config`:
7
+ *
8
+ * import { config, cardholder, oauth } from '@enfuce/nextgen-sdk';
9
+ *
10
+ * const te = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
11
+ * const conf = new cardholder.Configuration({ basePath: config.issuerBaseUrl(te) });
12
+ * const tokens = oauth.clientCredentials({ tokenUrl: config.tokenUrl(te), clientId, clientSecret });
13
+ */
14
+ export {
15
+ TenantEnvironment,
16
+ apiBaseUrl,
17
+ issuerBaseUrl,
18
+ processorBaseUrl,
19
+ exchangeRateBaseUrl,
20
+ tokenUrl,
21
+ } from './enfuceUrls';
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  /* One namespaced export per API. Usage: import { card } from '@enfuce/nextgen-sdk'; */
3
3
 
4
4
  export * as oauth from './oauth';
5
+ export * as config from './config';
5
6
 
6
7
  export * as card from './card';
7
8
  export * as wallet from './wallet';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Tests for the hand-written tenant/environment URL helper (src/config).
3
+ */
4
+ import { describe, expect, it } from 'vitest';
5
+ import { config } from '../src';
6
+
7
+ const sandbox: config.TenantEnvironment = { tenant: 'swile', environment: 'ext-uat1-sandbox' };
8
+
9
+ describe('config URL helpers', () => {
10
+ it('derives per-domain base URLs as api.<tenant>.<environment>.mycore.enfuce.com/<domain>', () => {
11
+ expect(config.apiBaseUrl(sandbox)).toBe('https://api.swile.ext-uat1-sandbox.mycore.enfuce.com');
12
+ expect(config.issuerBaseUrl(sandbox)).toBe('https://api.swile.ext-uat1-sandbox.mycore.enfuce.com/issuer');
13
+ expect(config.processorBaseUrl(sandbox)).toBe('https://api.swile.ext-uat1-sandbox.mycore.enfuce.com/processor');
14
+ expect(config.exchangeRateBaseUrl(sandbox)).toBe(
15
+ 'https://api.swile.ext-uat1-sandbox.mycore.enfuce.com/exchange-rates-api',
16
+ );
17
+ });
18
+
19
+ it('derives the token URL from the auth host', () => {
20
+ expect(config.tokenUrl(sandbox)).toBe('https://auth.swile.ext-uat1-sandbox.mycore.enfuce.com/oauth2/token');
21
+ });
22
+
23
+ it('places a multi-segment environment verbatim', () => {
24
+ expect(config.issuerBaseUrl({ tenant: 'swile', environment: 'eu.live.prod' })).toBe(
25
+ 'https://api.swile.eu.live.prod.mycore.enfuce.com/issuer',
26
+ );
27
+ });
28
+
29
+ it('rejects an empty tenant or environment', () => {
30
+ expect(() => config.issuerBaseUrl({ tenant: ' ', environment: 'env' })).toThrow();
31
+ expect(() => config.tokenUrl({ tenant: 'swile', environment: '' })).toThrow();
32
+ });
33
+ });