@gyldendalas/gyldendal-divine-api 1.1.6 → 1.1.8

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.
package/README.md CHANGED
@@ -17,22 +17,29 @@ constructor (the `installationpurpose` of the TYPO3 installation), unless
17
17
 
18
18
  ### Local services
19
19
 
20
- `local` is for running the services yourself while developing. Ports follow
21
- each service's own development setup where one exists, and avoid the ports
22
- the frontends and sibling services already use locally (3000-3002 nuxt, 3010
23
- mock server, 8000/8100 DynamoDB local, 8001 DynamoDB admin).
20
+ `local` is for running the services yourself while developing. The services sit
21
+ in one reserved 4110-4180 block, ten apart, so a service and its own
22
+ dependencies (DynamoDB local, its admin UI) stay together and nothing collides
23
+ with the frontends (3000-3002 nuxt, 3010 mock server), the macOS AirPlay
24
+ Receiver (5000, 7000), the container defaults the services themselves use
25
+ (8000, 8001, 5432, 8983) or the ephemeral range (49152 and up). Each service's
26
+ docker-compose publishes its port on 127.0.0.1 only, and the URLs below say
27
+ 127.0.0.1 rather than localhost for that reason: localhost resolves to ::1
28
+ first on macOS, where an IPv4-only mapping is not listening. The `test`
29
+ environment keeps localhost, because the Playwright mock server's certificate
30
+ is issued for that name.
24
31
 
25
32
  | service | local URL | source of the port |
26
33
  |---|---|---|
27
- | highlight | `http://localhost:3030` | `systime_highlight_server` docker-compose-development |
28
- | user settings | `http://localhost:4000` | `user_settings_service` Dockerfile |
29
- | pdf generator | `http://localhost:3050` | `pdf_generation_service` docker-compose-development |
30
- | writing task | `http://localhost:4050` | chosen; 5000 is taken by macOS AirPlay Receiver |
31
- | AI bot | `http://localhost:3100` | `ai-bot-service` main.py |
32
- | cookie consent log | `http://localhost:1337` | `cookie_consent_service` docker-compose |
33
- | tagging | `http://localhost:8010` | chosen; its uvicorn default 8000 collides with the other local services |
34
- | solr proxy | `http://localhost:8090` | chosen; its uvicorn default 8000 collides with the other local services |
35
- | polly | `http://localhost:3200` | chosen; its container port 3000 is taken by nuxt dev |
34
+ | user settings | `http://127.0.0.1:4110` | `user_settings_service` docker-compose (DynamoDB 4111, admin 4112) |
35
+ | highlight | `http://127.0.0.1:4120` | `systime_highlight_server` docker-compose-development (DynamoDB 4121, admin 4122, pgvector 4123) |
36
+ | pdf generator | `http://127.0.0.1:4130` | `pdf_generation_service` docker-compose-development |
37
+ | writing task | `http://127.0.0.1:4140` | `stepwise_task_server` docker-compose-development (DynamoDB 4141, admin 4142) |
38
+ | solr proxy | `http://127.0.0.1:4150` | `solr-proxy` docker-compose-development (solr itself 4151) |
39
+ | tagging | `http://127.0.0.1:4160` | reserved here; the repo has no development compose yet |
40
+ | AI bot | `http://127.0.0.1:4170` | reserved here; `ai-bot-service` main.py defaults to 3100 |
41
+ | cookie consent log | `http://127.0.0.1:4180` | reserved here; `cookie_consent_service` compose defaults to 1337 |
42
+ | polly | `http://127.0.0.1:3200` | `systime-appear-polly` docker-compose-development; its container port 3000 is taken by nuxt dev. Synthesis needs AWS credentials, and the container's CORS preflight currently rejects the `Authorization` header this SDK sends |
36
43
  | quiz (Gale CMS) | `https://galecms.test.tibalo.dk/api` | no local Gale, shared test instance |
37
44
 
38
45
  Run a service on a different port by passing `serviceUrl` to its constructor.
package/dist/index.cjs CHANGED
@@ -152,7 +152,7 @@ var TaggingService = class extends BaseService {
152
152
  case "production": return `https://tagging.services.${this.baseDomain}`;
153
153
  case "development":
154
154
  case "testing": return `https://staging-tagging.services.${this.baseDomain}`;
155
- case "local": return `http://localhost:8010`;
155
+ case "local": return `http://127.0.0.1:4160`;
156
156
  case "test": return `https://localhost:3010/services/tagging`;
157
157
  default: throw new Error(`Unknown environment: ${this.environment}`);
158
158
  }
@@ -223,7 +223,7 @@ var PollyService = class extends BaseService {
223
223
  case "production": return `https://appear-polly.services.${this.baseDomain}`;
224
224
  case "development":
225
225
  case "testing": return `https://staging-appear-polly.services.${this.baseDomain}`;
226
- case "local": return `http://localhost:3200`;
226
+ case "local": return `http://127.0.0.1:3200`;
227
227
  case "test": return `https://localhost:3010/services/polly`;
228
228
  default: throw new Error(`Unknown environment: ${this.environment}`);
229
229
  }
@@ -248,7 +248,7 @@ var CookieConsentLog = class extends BaseService {
248
248
  case "production": return `https://cookieconsentlog.services.${this.baseDomain}`;
249
249
  case "development":
250
250
  case "testing": return `https://staging-cookieconsentlog.services.${this.baseDomain}`;
251
- case "local": return `http://localhost:1337`;
251
+ case "local": return `http://127.0.0.1:4180`;
252
252
  case "test": return `https://localhost:3010/services/cookieconsentlog`;
253
253
  default: throw new Error(`Unknown environment: ${this.environment}`);
254
254
  }
@@ -279,7 +279,7 @@ var HighlightService = class extends BaseService {
279
279
  case "production": return `https://highlights.services.${this.baseDomain}`;
280
280
  case "development":
281
281
  case "testing": return `https://staging-highlights.services.${this.baseDomain}`;
282
- case "local": return `http://localhost:3030`;
282
+ case "local": return `http://127.0.0.1:4120`;
283
283
  case "test": return `https://localhost:3010/services/highlight`;
284
284
  default: throw new Error(`Unknown environment: ${this.environment}`);
285
285
  }
@@ -360,7 +360,7 @@ var UserSettingsBase = class extends BaseService {
360
360
  case "production": return `https://user-settings-service.services.${this.baseDomain}`;
361
361
  case "development":
362
362
  case "testing": return `https://staging-user-settings-service.services.${this.baseDomain}`;
363
- case "local": return `http://localhost:4000`;
363
+ case "local": return `http://127.0.0.1:4110`;
364
364
  case "test": return `https://localhost:3010/services/usersettingsservice`;
365
365
  default: throw new Error(`Unknown environment: ${this.environment}`);
366
366
  }
@@ -532,7 +532,7 @@ var PdfGeneratorService = class extends BaseService {
532
532
  case "production": return `https://pdfgenerator.services.${this.baseDomain}`;
533
533
  case "development":
534
534
  case "testing": return `https://staging-pdfgenerator.services.${this.baseDomain}`;
535
- case "local": return `http://localhost:3050`;
535
+ case "local": return `http://127.0.0.1:4130`;
536
536
  case "test": return `https://localhost:3010/services/pdfgenerator`;
537
537
  default: throw new Error(`Unknown environment: ${this.environment}`);
538
538
  }
@@ -883,7 +883,7 @@ var AIBotService = class extends BaseService {
883
883
  case "production": return `https://ai-bot-service.eu-west-1.${this.baseDomain}`;
884
884
  case "development":
885
885
  case "testing": return `https://ai-bot-service-staging.eu-west-1.${this.baseDomain}`;
886
- case "local": return `http://localhost:3100`;
886
+ case "local": return `http://127.0.0.1:4170`;
887
887
  case "test": return `https://localhost:3010/services/aibotservice`;
888
888
  default: throw new Error(`Unknown environment: ${this.environment}`);
889
889
  }
@@ -944,6 +944,19 @@ var QuizService = class extends BaseService {
944
944
  default: throw new Error(`Unknown environment: ${this.environment}`);
945
945
  }
946
946
  }
947
+ /**
948
+ * Where a mediafile `identifier` is served from: the API prefix without its
949
+ * path, so the host mapping stays in `discoverUrlPrefix()` alone and an
950
+ * explicit `serviceUrl` is honoured the way `getUrlPrefix()` honours it.
951
+ *
952
+ * The exception is the mock environment, where the app serves the fixtures
953
+ * itself and their identifiers are already relative to it — unless a
954
+ * `serviceUrl` is set, which overrides the environment there as everywhere.
955
+ */
956
+ getMediaUrlPrefix() {
957
+ if (!this.serviceUrl && this.environment === "test") return "";
958
+ return new URL(this.getUrlPrefix()).origin;
959
+ }
947
960
  makeHeaders(extra) {
948
961
  const headers = new Headers();
949
962
  headers.append("Content-Type", "application/json");
@@ -1163,7 +1176,7 @@ var WritingTaskService = class extends BaseService {
1163
1176
  case "production": return `https://writingtask.services.${this.baseDomain}`;
1164
1177
  case "development":
1165
1178
  case "testing": return `https://staging-writingtask.services.${this.baseDomain}`;
1166
- case "local": return `http://localhost:4050`;
1179
+ case "local": return `http://127.0.0.1:4140`;
1167
1180
  case "test": return `https://localhost:3010/services/writingtask`;
1168
1181
  default: throw new Error(`Unknown environment: ${this.environment}`);
1169
1182
  }
@@ -1232,7 +1245,7 @@ var SolrProxyService = class extends BaseService {
1232
1245
  case "production": return `https://solr-proxy.eu-west-1.${this.baseDomain}`;
1233
1246
  case "development":
1234
1247
  case "testing": return `https://solr-proxy-staging.eu-west-1.${this.baseDomain}`;
1235
- case "local": return `http://localhost:8090`;
1248
+ case "local": return `http://127.0.0.1:4150`;
1236
1249
  case "test": return `https://localhost:3010/services/solrproxy`;
1237
1250
  default: throw new Error(`Unknown environment: ${this.environment}`);
1238
1251
  }