epicenter-libs 3.34.2 → 3.35.1

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 (40) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +61 -86
  3. package/dist/browser/epicenter.js +1589 -228
  4. package/dist/browser/epicenter.js.map +1 -1
  5. package/dist/cjs/epicenter.js +1512 -144
  6. package/dist/cjs/epicenter.js.map +1 -1
  7. package/dist/epicenter.js +1595 -227
  8. package/dist/epicenter.js.map +1 -1
  9. package/dist/epicenter.min.js +1 -1
  10. package/dist/epicenter.min.js.map +1 -1
  11. package/dist/module/epicenter.js +1506 -145
  12. package/dist/module/epicenter.js.map +1 -1
  13. package/dist/types/adapters/docket.d.ts +80 -0
  14. package/dist/types/adapters/encyclopedia.d.ts +86 -0
  15. package/dist/types/adapters/file.d.ts +201 -0
  16. package/dist/types/adapters/git.d.ts +171 -0
  17. package/dist/types/adapters/index.d.ts +8 -1
  18. package/dist/types/adapters/pipeline.d.ts +88 -0
  19. package/dist/types/adapters/powerpoint.d.ts +130 -0
  20. package/dist/types/adapters/registration.d.ts +270 -0
  21. package/dist/types/adapters/task.d.ts +99 -37
  22. package/dist/types/epicenter.d.ts +2 -2
  23. package/dist/types/types.d.ts +6 -1
  24. package/dist/types/utils/router.d.ts +1 -0
  25. package/package.json +12 -7
  26. package/src/adapters/authentication.ts +2 -1
  27. package/src/adapters/cometd.ts +7 -2
  28. package/src/adapters/docket.ts +109 -0
  29. package/src/adapters/encyclopedia.ts +128 -0
  30. package/src/adapters/file.ts +332 -0
  31. package/src/adapters/git.ts +278 -0
  32. package/src/adapters/index.ts +14 -0
  33. package/src/adapters/pipeline.ts +145 -0
  34. package/src/adapters/powerpoint.ts +238 -0
  35. package/src/adapters/registration.ts +413 -0
  36. package/src/adapters/task.ts +170 -47
  37. package/src/epicenter.ts +10 -3
  38. package/src/globals.d.ts +6 -0
  39. package/src/types.ts +61 -0
  40. package/src/utils/router.ts +1 -0
@@ -1,11 +1,11 @@
1
1
  import 'regenerator-runtime/runtime';
2
- declare const version = "Epicenter (v__VERSION__) for __BUILD__ | Build Date: __DATE__";
2
+ declare const version: string;
3
3
  import { Handler } from './utils/error-manager';
4
4
  export declare const DEFAULT_ERROR_HANDLERS: Record<string, Handler>;
5
5
  export * from './types';
6
6
  export { version };
7
7
  export { SCOPE_BOUNDARY, RITUAL, PUSH_CATEGORY, ROLE, } from './utils/constants';
8
8
  export { config, errorManager, Router, Fault, } from './utils';
9
- export { accountAdapter, adminAdapter, assetAdapter, consensusAdapter, emailAdapter, authAdapter, chatAdapter, episodeAdapter, groupAdapter, leaderboardAdapter, presenceAdapter, projectAdapter, recaptchaAdapter, runAdapter, taskAdapter, timeAdapter, userAdapter, vaultAdapter, videoAdapter, vonageAdapter, worldAdapter, somebodyAdapter, dailyAdapter, matchmakerAdapter, walletAdapter, Channel, cometdAdapter, } from './adapters';
9
+ export { accountAdapter, adminAdapter, assetAdapter, consensusAdapter, emailAdapter, authAdapter, chatAdapter, episodeAdapter, groupAdapter, leaderboardAdapter, presenceAdapter, projectAdapter, recaptchaAdapter, runAdapter, taskAdapter, timeAdapter, userAdapter, vaultAdapter, videoAdapter, vonageAdapter, worldAdapter, somebodyAdapter, dailyAdapter, matchmakerAdapter, walletAdapter, pipelineAdapter, encyclopediaAdapter, fileAdapter, registrationAdapter, docketAdapter, Channel, cometdAdapter, gitAdapter, powerpointAdapter, } from './adapters';
10
10
  export { videoAPI, vonageAPI, } from './apis';
11
11
  export * as utils from './utilities';
@@ -24,10 +24,15 @@ export type { Leaderboard, Score, Tag, } from './adapters/leaderboard';
24
24
  export type { Presence, } from './adapters/presence';
25
25
  export type { ACCESS_TYPE, AccessType, WORKER_PARTITION, WorkerPartition, PHYLOGENY, Phylogeny, FileType, CHANNEL_PROTOCOL, ChannelProtocol, ProjectMember, Deployment, TeamProject, PersonalProject, Project, } from './adapters/project';
26
26
  export type { RunReadOutView, RunVariables, RunMetadata, RunCreateOptions, RunStrategy, ExecutionContext, ModelContext, ModelContextDefaults, OperationOptions, VariableOptions, EventOptions, RewindMarker, ReplayOperation, ReplayRestoration, SnapshotRestoration, Restorations, Protections, InputGuard, OverwriteGuard, RelativeGuard, RoleGuard, PrivilegeGuard, V1ExecutionContext, V2ModelContext, ExcelModelControl, JavaModelControl, PowersimModelControl, VensimModelControl, VensimModelTool, StellaModelTool, ProcActionable, GetActionable, SetActionable, Actionable, Route, WireExternalFunction, AptExternalDependency, CranExternalDependency, GitExternalDependency, JuliaExternalDependency, NpmExternalDependency, PypiExternalDependency, ShellExternalDependency, MORPHOLOGY, MetadataFirstPop, MetadataLastPop, MetadataAllPop, MetadataPop, MetadataUpdate, } from './adapters/run';
27
- export type { RETRY_POLICY, TaskPayloadBody, TaskPayloadHeaders, StatusReadOutView, StatusCreateInView, CronTaskTriggerCreateInView, DateTaskTriggerCreateInView, OffsetTaskTriggerCreateInView, TaskTriggerCreateInView, HttpTaskPayloadCreateInView, GroupStatusTaskPayloadCreateInView, TaskPayloadCreateInView, HttpTaskPayloadReadOutView, GroupStatusTaskPayloadReadOutView, TaskPayloadReadOutView, TaskReadOutView, } from './adapters/task';
27
+ export type { RETRY_POLICY, TaskPayloadBody, TaskPayloadHeaders, TaskHttpMethod, TaskRetryPolicyReadOutView, TaskStatusReadOutView, TaskAddressReadOutView, TaskScopeReadOutView, StatusReadOutView, StatusCreateInView, CronTaskTriggerCreateInView, DateTaskTriggerCreateInView, OffsetTaskTriggerCreateInView, TaskTriggerCreateInView, HttpTaskPayloadCreateInView, GroupStatusTaskPayloadCreateInView, TaskPayloadCreateInView, HttpTaskPayloadCreateInput, TaskPayloadCreateInput, HttpTaskPayloadReadOutView, GroupStatusTaskPayloadReadOutView, TaskPayloadReadOutView, TaskReadOutView, TaskHistoryReadOutView, TaskPageOptions, TaskScopePageOptions, } from './adapters/task';
28
28
  export type { UserReadOutView, UserCreateInView, NativeUserCreateInView, ExternalUserCreateInView, ExternalUserReadOutView, NativeUserReadOutView, PseudonymReadOutView, UserReport, DiscardedUser, MFADetailReadOutView, MFADetailCreateInView, GraftReadOutView, GraftCreateInView, SecretCreateInView, GroupRelationshipReadOutView, UploadOptions, Modality, MFAMethodology, Countdown, RealmData, } from './adapters/user';
29
29
  export type { Vault, VaultItems, Items, } from './adapters/vault';
30
30
  export type { WalletReadOutView, WalletItemReadOutView, WalletItemCreateInView, } from './adapters/wallet';
31
31
  export type { WorldReadOutView, WorldRole, AssignmentReadOutView, AssignmentCreateInView, PersonaReadOutView, PersonaCreateInView, AssignmentMap, ColorAnimalWorldNameGenerator, SequentialWorldNameGenerator, WorldNameGenerator, WORLD_NAME_GENERATOR_TYPE, WorldNameGeneratorType, OBJECTIVE, Objective, OrbitType, } from './adapters/world';
32
+ export type { FileEntry, DirectoryEntry, FileSystemEntry, } from './adapters/file';
33
+ export type { RegistrationInfo, TeamRegistrationInfo, RegistrationResult, WhoAmI, WhoAmIObjectType, TeamRole, SsoProtocol, } from './adapters/registration';
34
+ export type { OperatingSystem, WorkerShape, ScaleFlavor, ScaleCreateInView, ScaleReadOutView, ScaleDocketPayloadCreateInView, ScaleDocketPayloadReadOutView, DocketPayloadCreateInView, DocketPayloadReadOutView, DocketReadOutView, } from './adapters/docket';
35
+ export type { EncyclopediaTranslator, DocumentedEndpointMethod, DocumentedEndpointAuthorization, DocumentedEndpointNotation, DocumentedParameterSource, DocumentedParameter, DocumentedEndpoint, DocumentedResource, KnownServiceReadOutView, } from './adapters/encyclopedia';
36
+ export type { PipelineExecutionStatus, PipelineAuditReadOutView, } from './adapters/pipeline';
32
37
  export type { Somebody, } from './adapters/somebody';
33
38
  export type { VideoReadOutView, VideoDir, AFFILIATE, Affiliate, MEDIA_FORMAT, MediaFormat, LANGUAGE_CODE, LanguageCode, ProcessingType, } from './apis/video';
@@ -34,6 +34,7 @@ export interface RetryFunction<Output> {
34
34
  export interface Page<Item> {
35
35
  firstResult: number;
36
36
  maxResults: number;
37
+ resultSize: number;
37
38
  totalResults: number;
38
39
  values: Item[];
39
40
  prev: () => Promise<Item[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epicenter-libs",
3
- "version": "3.34.2",
3
+ "version": "3.35.1",
4
4
  "main": "dist/cjs/epicenter.js",
5
5
  "type": "module",
6
6
  "module": "dist/module/epicenter.js",
@@ -13,8 +13,9 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "test": "vitest",
16
- "test:run": "vitest run",
17
- "test:coverage": "vitest run --coverage",
16
+ "test:run": "npm run type-check && vitest run",
17
+ "test:coverage": "npm run type-check && vitest run --coverage",
18
+ "test:dist": "npm run build && vitest run --config vitest.dist.config.js",
18
19
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
19
20
  "changelog:all": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
20
21
  "type-check": "tsc --noEmit",
@@ -23,9 +24,7 @@
23
24
  "build:types": "tsc --emitDeclarationOnly",
24
25
  "build:js": "rollup -c -m",
25
26
  "build": "npm run build:clean && npm run build:types && npm run build:js",
26
- "build:test": "rollup -c rollup.config.test.js",
27
- "pretest": "npm run type-check && npm run build:test",
28
- "pretest:run": "npm run type-check && npm run build:test",
27
+ "prepublishOnly": "npm run test:run && npm run test:dist",
29
28
  "start": "rollup -c -m inline -w",
30
29
  "prepare": "node -e \"if (!process.env.CI && !process.env.JENKINS_HOME) require('child_process').execSync('husky', {stdio: 'inherit'})\""
31
30
  },
@@ -50,6 +49,11 @@
50
49
  "cometd": "^8.0.9",
51
50
  "cross-fetch": "^3.0.6"
52
51
  },
52
+ "overrides": {
53
+ "tar": "^7.5.16",
54
+ "esbuild": "^0.28.1",
55
+ "sigstore": "^4.1.1"
56
+ },
53
57
  "devDependencies": {
54
58
  "@babel/cli": "^7.26.0",
55
59
  "@babel/core": "^7.26.0",
@@ -70,9 +74,10 @@
70
74
  "@rollup/plugin-json": "^6.1.0",
71
75
  "@rollup/plugin-node-resolve": "^15.3.0",
72
76
  "@rollup/plugin-replace": "^6.0.2",
73
- "@rollup/plugin-terser": "^0.4.4",
77
+ "@rollup/plugin-terser": "^1.0.0",
74
78
  "@stylistic/eslint-plugin": "^5.4.0",
75
79
  "@types/cometd": "^4.0.8",
80
+ "@vitest/coverage-v8": "^3.2.6",
76
81
  "babel-loader": "^9.2.1",
77
82
  "conventional-changelog": "^7.1.1",
78
83
  "conventional-changelog-angular": "^8.0.0",
@@ -112,7 +112,8 @@ export function setLocalSession(session: Session): Session {
112
112
  */
113
113
  export async function removeLocalSession(): Promise<void> {
114
114
  identification.session = undefined;
115
- await cometdAdapter.disconnect();
115
+ // CometD disconnect is best-effort cleanup; its failure must not fail session removal
116
+ await cometdAdapter.disconnect().catch(() => undefined);
116
117
  }
117
118
 
118
119
 
@@ -20,6 +20,7 @@ const CONNECT_META_CHANNEL = '/meta/connect';
20
20
  const DISCONNECT_META_CHANNEL = '/meta/disconnect';
21
21
  const HANDSHAKE_META_CHANNEL = '/meta/handshake';
22
22
  const COMETD_RECONNECTED = 'COMETD_RECONNECTED';
23
+ const CHANNELS_NOT_ENABLED = 'CHANNELS_NOT_ENABLED';
23
24
  const DEFAULT_CHANNEL_PROTOCOL = 'cometd';
24
25
 
25
26
  type HandshakeState = 'idle' | 'handshaking' | 'succeeded' | 'failed';
@@ -85,7 +86,7 @@ class CometdAdapter {
85
86
 
86
87
  async startup(options: { logLevel: 'info' | 'debug' | 'warn' } = { logLevel: 'warn' }) {
87
88
  const project = await getProject();
88
- if (!project.channelEnabled) throw new EpicenterError('Push Channels are not enabled on this project');
89
+ if (!project.channelEnabled) throw new EpicenterError('Push Channels are not enabled on this project', CHANNELS_NOT_ENABLED);
89
90
  const channelProtocol = project.channelProtocol?.toLowerCase() || DEFAULT_CHANNEL_PROTOCOL;
90
91
  const { CometD } = await import('cometd');
91
92
  const { AckExtension } = await import('cometd');
@@ -196,7 +197,11 @@ class CometdAdapter {
196
197
 
197
198
  async init(options?: { logLevel: 'info' | 'debug' | 'warn' }) {
198
199
  if (!this.initialization) {
199
- this.initialization = this.startup(options);
200
+ // A rejected startup must not be cached, or every later init() call re-throws it
201
+ this.initialization = this.startup(options).catch((error) => {
202
+ this.initialization = undefined;
203
+ throw error;
204
+ });
200
205
  }
201
206
  return this.initialization;
202
207
  }
@@ -0,0 +1,109 @@
1
+ import type { RoutingOptions } from '../utils/router';
2
+ import type { TaskTriggerCreateInView } from './task';
3
+
4
+ import { Router } from '../utils';
5
+
6
+ export type OperatingSystem = 'LINUX' | 'MAC' | 'WINDOWS';
7
+
8
+ export type WorkerShape =
9
+ | 'GS' | 'GM' | 'GL' | 'GXL' | 'G2XL' | 'G4XL'
10
+ | 'ML' | 'MXL' | 'M2XL' | 'M4XL'
11
+ | 'CL' | 'CXL' | 'C2XL' | 'C4XL';
12
+
13
+ export type ScaleFlavor = 'PROCESS' | 'DOCKER' | 'JVM' | 'WSDL';
14
+
15
+ export interface ScaleCreateInView {
16
+ active: boolean;
17
+ initialWorkerCount: number;
18
+ additionalWorkerLimit: number;
19
+ flavors?: ScaleFlavor[];
20
+ }
21
+
22
+ export interface ScaleReadOutView {
23
+ active?: boolean | null;
24
+ initialWorkerCount?: number | null;
25
+ additionalWorkerLimit?: number | null;
26
+ flavors?: ScaleFlavor[] | null;
27
+ test?: boolean | null;
28
+ shape?: WorkerShape | null;
29
+ operatingSystem?: OperatingSystem | null;
30
+ }
31
+
32
+ export interface ScaleDocketPayloadCreateInView {
33
+ objectType: 'scale';
34
+ scale: ScaleCreateInView;
35
+ operatingSystem: OperatingSystem;
36
+ workerShape: WorkerShape;
37
+ test?: boolean;
38
+ }
39
+
40
+ export interface ScaleDocketPayloadReadOutView {
41
+ objectType: 'scale';
42
+ scale?: ScaleReadOutView | null;
43
+ operatingSystem?: OperatingSystem | null;
44
+ workerShape?: WorkerShape | null;
45
+ test?: boolean | null;
46
+ }
47
+
48
+ export type DocketPayloadCreateInView = ScaleDocketPayloadCreateInView;
49
+ export type DocketPayloadReadOutView = ScaleDocketPayloadReadOutView;
50
+
51
+ export interface DocketReadOutView {
52
+ docketKey?: string | null;
53
+ date?: string | null;
54
+ payload?: DocketPayloadReadOutView | null;
55
+ ttlMinutes?: number | null;
56
+ complete?: boolean | null;
57
+ error?: string | null;
58
+ attempts?: number | null;
59
+ }
60
+
61
+
62
+ /**
63
+ * Creates a new docket entry, scheduling a deferred operation for later execution.
64
+ * Requires `support` level authorization.
65
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/docket`
66
+ *
67
+ * @example
68
+ * import { docketAdapter } from 'epicenter-libs';
69
+ * const docket = await docketAdapter.create(
70
+ * {
71
+ * objectType: 'scale',
72
+ * operatingSystem: 'LINUX',
73
+ * workerShape: 'GS',
74
+ * scale: {
75
+ * active: true,
76
+ * initialWorkerCount: 1,
77
+ * additionalWorkerLimit: 4,
78
+ * flavors: ['DOCKER'],
79
+ * },
80
+ * },
81
+ * { objectType: 'date', value: '2026-06-01T00:00:00Z' },
82
+ * '2026-05-20T00:00:00Z',
83
+ * { ttlMinutes: 60 },
84
+ * );
85
+ *
86
+ * @param payload Docket payload describing the operation to schedule
87
+ * @param trigger Trigger describing when the operation should fire
88
+ * (cron, date, or offset)
89
+ * @param date ISO-8601 date string indicating when the docket is scheduled
90
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
91
+ * @param [optionals.ttlMinutes] Time-to-live in minutes for the docket entry (minimum 2)
92
+ * @returns promise that resolves to the newly created docket
93
+ */
94
+ export async function create(
95
+ payload: DocketPayloadCreateInView,
96
+ trigger: TaskTriggerCreateInView,
97
+ date: string,
98
+ optionals: {
99
+ ttlMinutes?: number;
100
+ } & RoutingOptions = {},
101
+ ): Promise<DocketReadOutView> {
102
+ const { ttlMinutes, ...routingOptions } = optionals;
103
+ return await new Router()
104
+ .post('/docket', {
105
+ body: { payload, trigger, date, ttlMinutes },
106
+ ...routingOptions,
107
+ })
108
+ .then(({ body }) => body);
109
+ }
@@ -0,0 +1,128 @@
1
+ import type { RoutingOptions } from '../utils/router';
2
+
3
+ import { Router } from '../utils';
4
+
5
+
6
+ export type EncyclopediaTranslator = 'ASCIIDOC' | 'ASCIIDOC_TO_HTML' | 'OPENAPI';
7
+
8
+ export type DocumentedEndpointMethod = 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE';
9
+
10
+ export type DocumentedEndpointAuthorization = 'SYSTEM' | 'DASHBOARD' | 'OWNER' | 'AUTHOR' | 'SUPPORT' | 'REVIEWER' | 'FACILITATOR' | 'LEADER' | 'PARTICIPANT' | 'ANONYMOUS';
11
+
12
+ export type DocumentedEndpointNotation = 'POST_RATHER_THAN_GET' | 'UNSUPPORTED_IGNORED';
13
+
14
+ export type DocumentedParameterSource = 'PATH' | 'HEADER' | 'QUERY' | 'MATRIX';
15
+
16
+ export interface DocumentedParameter {
17
+ name?: string;
18
+ source?: DocumentedParameterSource;
19
+ type?: Record<string, unknown>;
20
+ }
21
+
22
+ export interface DocumentedEndpoint {
23
+ method?: DocumentedEndpointMethod;
24
+ path?: string;
25
+ authorization?: DocumentedEndpointAuthorization;
26
+ response?: Record<string, unknown>;
27
+ summary?: string;
28
+ description?: string;
29
+ deprecated?: boolean;
30
+ paged?: boolean;
31
+ notations?: DocumentedEndpointNotation[];
32
+ body?: Record<string, unknown>;
33
+ parameters?: DocumentedParameter[];
34
+ produces?: unknown[];
35
+ consumes?: unknown[];
36
+ }
37
+
38
+ export interface DocumentedResource {
39
+ silenced?: boolean;
40
+ endpoints?: DocumentedEndpoint[];
41
+ definitions?: Record<string, unknown>;
42
+ }
43
+
44
+ export interface KnownServiceReadOutView {
45
+ name?: string;
46
+ development?: boolean;
47
+ trusted?: boolean;
48
+ published?: boolean;
49
+ }
50
+
51
+
52
+ /**
53
+ * Lists the known API services available for the given encyclopedia version.
54
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/encyclopedia/v{version}`
55
+ *
56
+ * @example
57
+ * import { encyclopediaAdapter } from 'epicenter-libs';
58
+ * const services = await encyclopediaAdapter.listServices(3);
59
+ *
60
+ * @param version Encyclopedia version number
61
+ * @param [optionals] Optional arguments; pass network call options overrides here.
62
+ * @returns promise that resolves to an array of known service descriptors
63
+ */
64
+ export async function listServices(
65
+ version: number,
66
+ optionals: RoutingOptions = {},
67
+ ): Promise<KnownServiceReadOutView[]> {
68
+ return await new Router()
69
+ .get(`/encyclopedia/v${version}`, optionals)
70
+ .then(({ body }) => body);
71
+ }
72
+
73
+
74
+ /**
75
+ * Retrieves the documented resource (API documentation) for a specific service and encyclopedia version.
76
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/encyclopedia/v{version}/{api}`
77
+ *
78
+ * @example
79
+ * import { encyclopediaAdapter } from 'epicenter-libs';
80
+ * const resource = await encyclopediaAdapter.getResource(3, 'run');
81
+ *
82
+ * @param version Encyclopedia version number
83
+ * @param api Name of the API service to retrieve documentation for
84
+ * @param [optionals] Optional arguments; pass network call options overrides here.
85
+ * @returns promise that resolves to the documented resource containing endpoints and definitions
86
+ */
87
+ export async function getResource(
88
+ version: number,
89
+ api: string,
90
+ optionals: RoutingOptions = {},
91
+ ): Promise<DocumentedResource> {
92
+ return await new Router()
93
+ .get(`/encyclopedia/v${version}/${api}`, optionals)
94
+ .then(({ body }) => body);
95
+ }
96
+
97
+
98
+ /**
99
+ * Retrieves a translated representation of the API documentation for a specific service and encyclopedia version.
100
+ * Supported translators are ASCIIDOC, ASCIIDOC_TO_HTML, and OPENAPI.
101
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/encyclopedia/as/{translator}/v{version}/{api}`
102
+ *
103
+ * NOTE: The backend returns the translated content with a translator-specific content-type
104
+ * (e.g. `text/asciidoc`, `text/html`, `application/json`). The shared Router throws when the
105
+ * response content-type is not `application/json`, so only the OPENAPI translator works here.
106
+ * For ASCIIDOC and ASCIIDOC_TO_HTML, use the underlying fetch API directly against the
107
+ * constructed URL.
108
+ *
109
+ * @example
110
+ * import { encyclopediaAdapter } from 'epicenter-libs';
111
+ * const openApiDoc = await encyclopediaAdapter.translate('OPENAPI', 3, 'run');
112
+ *
113
+ * @param translator Output format for the documentation; one of 'ASCIIDOC', 'ASCIIDOC_TO_HTML', or 'OPENAPI'
114
+ * @param version Encyclopedia version number
115
+ * @param api Name of the API service to translate documentation for
116
+ * @param [optionals] Optional arguments; pass network call options overrides here.
117
+ * @returns promise that resolves to the translated documentation (only when translator is 'OPENAPI')
118
+ */
119
+ export async function translate(
120
+ translator: EncyclopediaTranslator,
121
+ version: number,
122
+ api: string,
123
+ optionals: RoutingOptions = {},
124
+ ): Promise<unknown> {
125
+ return await new Router()
126
+ .get(`/encyclopedia/as/${translator}/v${version}/${api}`, optionals)
127
+ .then(({ body }) => body);
128
+ }