@vtex/api 6.48.1-beta.3 → 6.48.1-beta.4
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/gen/manifest.schema +1 -1
- package/lib/HttpClient/GraphQLClient.d.ts +1 -1
- package/lib/HttpClient/HttpClient.d.ts +3 -2
- package/lib/HttpClient/HttpClient.js +14 -14
- package/lib/HttpClient/agents.d.ts +5 -2
- package/lib/HttpClient/agents.js +10 -4
- package/lib/HttpClient/index.js +7 -2
- package/lib/HttpClient/middlewares/cache.d.ts +1 -1
- package/lib/HttpClient/middlewares/cache.js +38 -36
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +2 -1
- package/lib/HttpClient/middlewares/inflight.d.ts +1 -1
- package/lib/HttpClient/middlewares/inflight.js +6 -3
- package/lib/HttpClient/middlewares/memoization.d.ts +1 -1
- package/lib/HttpClient/middlewares/memoization.js +9 -8
- package/lib/HttpClient/middlewares/metrics.js +8 -11
- package/lib/HttpClient/middlewares/notFound.d.ts +1 -1
- package/lib/HttpClient/middlewares/notFound.js +4 -2
- package/lib/HttpClient/middlewares/recorder.js +2 -5
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +1 -1
- package/lib/HttpClient/middlewares/request/index.d.ts +1 -1
- package/lib/HttpClient/middlewares/request/index.js +12 -9
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +5 -4
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +6 -5
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +1 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +8 -6
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +9 -7
- package/lib/HttpClient/middlewares/tracing.js +11 -14
- package/lib/HttpClient/typings.d.ts +2 -2
- package/lib/caches/DiskCache.js +3 -3
- package/lib/caches/LRUCache.d.ts +2 -2
- package/lib/caches/LRUDiskCache.d.ts +1 -1
- package/lib/caches/LRUDiskCache.js +3 -3
- package/lib/caches/MultilayeredCache.d.ts +2 -2
- package/lib/caches/MultilayeredCache.js +6 -6
- package/lib/caches/index.js +6 -2
- package/lib/caches/typings.d.ts +5 -5
- package/lib/clients/IOClient.d.ts +1 -1
- package/lib/clients/IOClients.d.ts +1 -1
- package/lib/clients/apps/AppClient.js +1 -1
- package/lib/clients/apps/AppGraphQLClient.js +1 -1
- package/lib/clients/apps/Billing.d.ts +1 -1
- package/lib/clients/apps/Builder.d.ts +7 -7
- package/lib/clients/apps/Builder.js +1 -1
- package/lib/clients/apps/MessagesGraphQL.d.ts +1 -1
- package/lib/clients/apps/MessagesGraphQL.js +3 -3
- package/lib/clients/apps/Settings.js +3 -3
- package/lib/clients/apps/catalogGraphQL/index.d.ts +4 -4
- package/lib/clients/apps/catalogGraphQL/index.js +4 -4
- package/lib/clients/apps/index.js +6 -2
- package/lib/clients/external/ID.d.ts +4 -4
- package/lib/clients/external/PaymentProvider.d.ts +2 -2
- package/lib/clients/external/index.js +6 -2
- package/lib/clients/index.js +6 -2
- package/lib/clients/infra/Apps.d.ts +32 -27
- package/lib/clients/infra/Apps.js +16 -18
- package/lib/clients/infra/Assets.d.ts +6 -5
- package/lib/clients/infra/Assets.js +11 -11
- package/lib/clients/infra/BillingMetrics.d.ts +1 -1
- package/lib/clients/infra/Events.d.ts +1 -1
- package/lib/clients/infra/Events.js +1 -1
- package/lib/clients/infra/Housekeeper.d.ts +3 -3
- package/lib/clients/infra/Registry.d.ts +23 -17
- package/lib/clients/infra/Registry.js +3 -4
- package/lib/clients/infra/Router.d.ts +8 -8
- package/lib/clients/infra/Sphinx.d.ts +2 -2
- package/lib/clients/infra/VBase.d.ts +15 -14
- package/lib/clients/infra/VBase.js +2 -2
- package/lib/clients/infra/Workspaces.d.ts +7 -7
- package/lib/clients/infra/index.js +6 -2
- package/lib/clients/janus/JanusClient.d.ts +1 -1
- package/lib/clients/janus/LicenseManager.js +1 -1
- package/lib/clients/janus/Segment.d.ts +3 -3
- package/lib/clients/janus/Segment.js +2 -2
- package/lib/clients/janus/Session.d.ts +2 -2
- package/lib/clients/janus/Tenant.d.ts +1 -1
- package/lib/clients/janus/index.js +6 -2
- package/lib/constants.d.ts +2 -1
- package/lib/constants.js +3 -2
- package/lib/errors/ResolverError.js +1 -1
- package/lib/errors/index.js +6 -2
- package/lib/index.js +6 -2
- package/lib/metrics/MetricsAccumulator.d.ts +2 -2
- package/lib/metrics/MetricsAccumulator.js +9 -9
- package/lib/responses.d.ts +4 -4
- package/lib/service/index.js +7 -9
- package/lib/service/loaders.js +8 -6
- package/lib/service/logger/client.d.ts +2 -0
- package/lib/service/logger/client.js +48 -0
- package/lib/service/logger/console.d.ts +1 -1
- package/lib/service/logger/console.js +7 -4
- package/lib/service/logger/index.d.ts +2 -0
- package/lib/service/logger/index.js +8 -2
- package/lib/service/logger/logger.d.ts +4 -15
- package/lib/service/logger/logger.js +61 -18
- package/lib/service/logger/loggerTypes.d.ts +14 -0
- package/lib/service/logger/loggerTypes.js +10 -0
- package/lib/service/logger/metricsLogger.js +10 -10
- package/lib/service/master.js +7 -6
- package/lib/service/metrics/requestMetricsMiddleware.js +14 -13
- package/lib/service/telemetry/client.d.ts +3 -0
- package/lib/service/telemetry/client.js +57 -0
- package/lib/service/telemetry/index.d.ts +1 -0
- package/lib/service/telemetry/index.js +17 -0
- package/lib/service/tracing/TracerSingleton.js +9 -9
- package/lib/service/tracing/metrics/MetricNames.js +12 -12
- package/lib/service/tracing/metrics/instruments.js +14 -7
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +5 -5
- package/lib/service/tracing/tracingMiddlewares.js +18 -21
- package/lib/service/worker/index.js +25 -24
- package/lib/service/worker/listeners.js +2 -1
- package/lib/service/worker/runtime/Service.js +1 -1
- package/lib/service/worker/runtime/builtIn/handlers.js +6 -3
- package/lib/service/worker/runtime/builtIn/middlewares.js +5 -3
- package/lib/service/worker/runtime/events/index.d.ts +1 -1
- package/lib/service/worker/runtime/events/index.js +11 -10
- package/lib/service/worker/runtime/events/middlewares/body.js +3 -6
- package/lib/service/worker/runtime/events/middlewares/context.js +1 -1
- package/lib/service/worker/runtime/events/router.js +3 -2
- package/lib/service/worker/runtime/graphql/index.js +8 -7
- package/lib/service/worker/runtime/graphql/middlewares/error.js +5 -8
- package/lib/service/worker/runtime/graphql/middlewares/query.js +7 -6
- package/lib/service/worker/runtime/graphql/middlewares/response.js +1 -1
- package/lib/service/worker/runtime/graphql/middlewares/run.js +3 -2
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +4 -3
- package/lib/service/worker/runtime/graphql/middlewares/upload.js +1 -1
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +1 -1
- package/lib/service/worker/runtime/graphql/schema/index.js +8 -7
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +2 -2
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +4 -3
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +1 -1
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +1 -1
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +2 -2
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +2 -2
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +1 -1
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +2 -1
- package/lib/service/worker/runtime/graphql/schema/typeDefs/sanitizedString.js +2 -2
- package/lib/service/worker/runtime/graphql/typings.d.ts +3 -3
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +2 -1
- package/lib/service/worker/runtime/graphql/utils/error.js +10 -9
- package/lib/service/worker/runtime/graphql/utils/pathname.js +3 -2
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +1 -1
- package/lib/service/worker/runtime/graphql/utils/translations.js +7 -4
- package/lib/service/worker/runtime/http/index.d.ts +2 -2
- package/lib/service/worker/runtime/http/index.js +22 -20
- package/lib/service/worker/runtime/http/middlewares/context.js +7 -5
- package/lib/service/worker/runtime/http/middlewares/error.js +1 -1
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +1 -1
- package/lib/service/worker/runtime/http/middlewares/setCookie.js +5 -5
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +1 -1
- package/lib/service/worker/runtime/http/middlewares/settings.js +13 -9
- package/lib/service/worker/runtime/http/middlewares/timings.js +3 -3
- package/lib/service/worker/runtime/http/router.js +3 -2
- package/lib/service/worker/runtime/http/routes.js +8 -5
- package/lib/service/worker/runtime/method.d.ts +2 -2
- package/lib/service/worker/runtime/method.js +1 -1
- package/lib/service/worker/runtime/statusTrack.d.ts +1 -1
- package/lib/service/worker/runtime/statusTrack.js +10 -5
- package/lib/service/worker/runtime/typings.d.ts +10 -10
- package/lib/service/worker/runtime/utils/compose.d.ts +2 -2
- package/lib/service/worker/runtime/utils/compose.js +4 -2
- package/lib/service/worker/runtime/utils/context.d.ts +2 -2
- package/lib/service/worker/runtime/utils/context.js +5 -4
- package/lib/service/worker/runtime/utils/recorder.js +1 -1
- package/lib/service/worker/runtime/utils/toArray.js +2 -1
- package/lib/tracing/UserLandTracer.js +3 -2
- package/lib/tracing/errorReporting/ErrorReport.js +13 -13
- package/lib/tracing/index.js +1 -1
- package/lib/tracing/utils.js +5 -4
- package/lib/utils/MineWinsConflictsResolver.d.ts +4 -4
- package/lib/utils/MineWinsConflictsResolver.js +10 -10
- package/lib/utils/app.js +39 -23
- package/lib/utils/appsStaleIfError.d.ts +1 -0
- package/lib/utils/appsStaleIfError.js +17 -9
- package/lib/utils/billingOptions.js +2 -1
- package/lib/utils/binding.js +4 -2
- package/lib/utils/domain.js +1 -1
- package/lib/utils/error.js +5 -4
- package/lib/utils/index.js +6 -2
- package/lib/utils/log.js +3 -2
- package/lib/utils/message.js +8 -5
- package/lib/utils/renameBy.js +2 -1
- package/lib/utils/retry.js +8 -6
- package/lib/utils/status.js +2 -1
- package/lib/utils/tenant.js +4 -2
- package/lib/utils/time.d.ts +1 -1
- package/lib/utils/time.js +23 -14
- package/package.json +26 -4
|
@@ -35,7 +35,7 @@ class CatalogGraphQL extends __1.AppGraphQLClient {
|
|
|
35
35
|
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
36
36
|
},
|
|
37
37
|
})
|
|
38
|
-
.then(ramda_1.prop('data'));
|
|
38
|
+
.then((0, ramda_1.prop)('data'));
|
|
39
39
|
};
|
|
40
40
|
this.product = (id, tracingConfig) => {
|
|
41
41
|
const variables = {
|
|
@@ -56,7 +56,7 @@ class CatalogGraphQL extends __1.AppGraphQLClient {
|
|
|
56
56
|
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
57
57
|
},
|
|
58
58
|
})
|
|
59
|
-
.then(ramda_1.prop('data'));
|
|
59
|
+
.then((0, ramda_1.prop)('data'));
|
|
60
60
|
};
|
|
61
61
|
this.category = (id, tracingConfig) => this.graphql
|
|
62
62
|
.query({
|
|
@@ -70,7 +70,7 @@ class CatalogGraphQL extends __1.AppGraphQLClient {
|
|
|
70
70
|
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
71
71
|
},
|
|
72
72
|
})
|
|
73
|
-
.then(ramda_1.prop('data'));
|
|
73
|
+
.then((0, ramda_1.prop)('data'));
|
|
74
74
|
this.brand = (id, tracingConfig) => this.graphql
|
|
75
75
|
.query({
|
|
76
76
|
inflight: true,
|
|
@@ -83,7 +83,7 @@ class CatalogGraphQL extends __1.AppGraphQLClient {
|
|
|
83
83
|
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
84
84
|
},
|
|
85
85
|
})
|
|
86
|
-
.then(ramda_1.prop('data'));
|
|
86
|
+
.then((0, ramda_1.prop)('data'));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
exports.CatalogGraphQL = CatalogGraphQL;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./AppClient"), exports);
|
|
@@ -3,10 +3,10 @@ import { IOContext } from '../../service/worker/runtime/typings';
|
|
|
3
3
|
import { ExternalClient } from './ExternalClient';
|
|
4
4
|
export declare class ID extends ExternalClient {
|
|
5
5
|
constructor(context: IOContext, opts?: InstanceOptions);
|
|
6
|
-
getTemporaryToken: (tracingConfig?: RequestTracingConfig
|
|
7
|
-
sendCodeToEmail: (token: string, email: string, tracingConfig?: RequestTracingConfig
|
|
8
|
-
getEmailCodeAuthenticationToken: (token: string, email: string, code: string, tracingConfig?: RequestTracingConfig
|
|
9
|
-
getPasswordAuthenticationToken: (token: string, email: string, password: string, tracingConfig?: RequestTracingConfig
|
|
6
|
+
getTemporaryToken: (tracingConfig?: RequestTracingConfig) => Promise<string>;
|
|
7
|
+
sendCodeToEmail: (token: string, email: string, tracingConfig?: RequestTracingConfig) => Promise<any>;
|
|
8
|
+
getEmailCodeAuthenticationToken: (token: string, email: string, code: string, tracingConfig?: RequestTracingConfig) => Promise<AuthenticationResponse>;
|
|
9
|
+
getPasswordAuthenticationToken: (token: string, email: string, password: string, tracingConfig?: RequestTracingConfig) => Promise<AuthenticationResponse>;
|
|
10
10
|
}
|
|
11
11
|
export interface AuthenticationResponse {
|
|
12
12
|
promptMFA: boolean;
|
|
@@ -4,8 +4,8 @@ import { ExternalClient } from './ExternalClient';
|
|
|
4
4
|
export declare class PaymentProvider extends ExternalClient {
|
|
5
5
|
protected context: IOContext;
|
|
6
6
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
7
|
-
callback: (transactionId: string, paymentId: string, callback: AuthorizationCallback, tracingConfig?: RequestTracingConfig
|
|
8
|
-
inbound: <TRequest, TResponse>(transactionId: string, paymentId: string, action: string, payload: TRequest, tracingConfig?: RequestTracingConfig
|
|
7
|
+
callback: (transactionId: string, paymentId: string, callback: AuthorizationCallback, tracingConfig?: RequestTracingConfig) => Promise<unknown>;
|
|
8
|
+
inbound: <TRequest, TResponse>(transactionId: string, paymentId: string, action: string, payload: TRequest, tracingConfig?: RequestTracingConfig) => Promise<TResponse>;
|
|
9
9
|
}
|
|
10
10
|
export interface AuthorizationCallback {
|
|
11
11
|
paymentId: string;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./ExternalClient"), exports);
|
package/lib/clients/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
2
5
|
import { IncomingMessage } from 'http';
|
|
3
6
|
import { Readable, Writable } from 'stream';
|
|
4
7
|
import { ZlibOptions } from 'zlib';
|
|
5
8
|
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
6
|
-
import {
|
|
9
|
+
import { AppFilesList, AppManifest } from '../../responses';
|
|
7
10
|
import { IOContext } from '../../service/worker/runtime/typings';
|
|
8
11
|
import { InfraClient } from './InfraClient';
|
|
9
12
|
export declare class Apps extends InfraClient {
|
|
@@ -12,35 +15,37 @@ export declare class Apps extends InfraClient {
|
|
|
12
15
|
private memoryCache;
|
|
13
16
|
private get routes();
|
|
14
17
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
15
|
-
installApp: (descriptor: string, tracingConfig?: RequestTracingConfig
|
|
16
|
-
uninstallApp: (app: string, tracingConfig?: RequestTracingConfig
|
|
17
|
-
acknowledgeApp: (app: string, service: string, tracingConfig?: RequestTracingConfig
|
|
18
|
-
link: (app: string, files: Change[], { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
installApp: (descriptor: string, tracingConfig?: RequestTracingConfig) => Promise<void> | Promise<AppInstallResponse>;
|
|
19
|
+
uninstallApp: (app: string, tracingConfig?: RequestTracingConfig) => Promise<import("../..").IOResponse<void>>;
|
|
20
|
+
acknowledgeApp: (app: string, service: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
21
|
+
link: (app: string, files: Change[], { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig) => Promise<import("../..").AppBundleResponse & {
|
|
22
|
+
bundleSize?: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
patch: (app: string, changes: Change[], { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
25
|
+
unlink: (app: string, tracingConfig?: RequestTracingConfig) => Promise<import("../..").IOResponse<void>>;
|
|
26
|
+
unlinkAll: (tracingConfig?: RequestTracingConfig) => Promise<import("../..").IOResponse<void>>;
|
|
27
|
+
saveAppSettings: (app: string, settings: any, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
28
|
+
listApps: ({ oldVersion, since, service }?: ListAppsOptions, tracingConfig?: RequestTracingConfig) => Promise<AppsList>;
|
|
29
|
+
listAppFiles: (app: string, { prefix, nextMarker }?: ListFilesOptions, tracingConfig?: RequestTracingConfig) => Promise<AppFilesList>;
|
|
30
|
+
listLinks: (tracingConfig?: RequestTracingConfig) => Promise<string[]>;
|
|
31
|
+
getAppFile: (app: string, path: string, staleIfError?: boolean, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
27
32
|
data: Buffer;
|
|
28
33
|
headers: any;
|
|
29
34
|
}>;
|
|
30
|
-
getAppJSON: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean
|
|
31
|
-
getFileFromApps: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean
|
|
32
|
-
getAppFileStream: (app: string, path: string, tracingConfig?: RequestTracingConfig
|
|
33
|
-
getApp: (app: string, tracingConfig?: RequestTracingConfig
|
|
34
|
-
getAppSettings: (app: string, tracingConfig?: RequestTracingConfig
|
|
35
|
-
getAllAppsSettings: (listAppsOptions?: ListAppsOptions, tracingConfig?: RequestTracingConfig
|
|
36
|
-
getAppBundle: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig
|
|
37
|
-
unpackAppBundle: (app: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig
|
|
38
|
-
getAppsMetaInfos: (filter?: string
|
|
39
|
-
getDependencies: (filter?: string, tracingConfig?: RequestTracingConfig
|
|
40
|
-
updateDependencies: (tracingConfig?: RequestTracingConfig
|
|
41
|
-
updateDependency: (name: string, version: string, registry: string, tracingConfig?: RequestTracingConfig
|
|
42
|
-
resolveDependencies: (apps: string[], registries: string[], filter?: string, tracingConfig?: RequestTracingConfig
|
|
43
|
-
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig
|
|
35
|
+
getAppJSON: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<T>;
|
|
36
|
+
getFileFromApps: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<T>;
|
|
37
|
+
getAppFileStream: (app: string, path: string, tracingConfig?: RequestTracingConfig) => Promise<IncomingMessage>;
|
|
38
|
+
getApp: (app: string, tracingConfig?: RequestTracingConfig) => Promise<AppManifest>;
|
|
39
|
+
getAppSettings: (app: string, tracingConfig?: RequestTracingConfig) => Promise<any>;
|
|
40
|
+
getAllAppsSettings: (listAppsOptions?: ListAppsOptions, tracingConfig?: RequestTracingConfig) => Promise<AppsSettings>;
|
|
41
|
+
getAppBundle: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig) => Promise<Readable>;
|
|
42
|
+
unpackAppBundle: (app: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig) => Promise<Writable>;
|
|
43
|
+
getAppsMetaInfos: (filter?: string, staleWhileRevalidate?: boolean, tracingConfig?: RequestTracingConfig) => Promise<AppMetaInfo[]>;
|
|
44
|
+
getDependencies: (filter?: string, tracingConfig?: RequestTracingConfig) => Promise<Record<string, string[]>>;
|
|
45
|
+
updateDependencies: (tracingConfig?: RequestTracingConfig) => Promise<Record<string, string[]>>;
|
|
46
|
+
updateDependency: (name: string, version: string, registry: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
47
|
+
resolveDependencies: (apps: string[], registries: string[], filter?: string, tracingConfig?: RequestTracingConfig) => Promise<any>;
|
|
48
|
+
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig) => Promise<Record<string, string[]>>;
|
|
44
49
|
private installRuntime;
|
|
45
50
|
}
|
|
46
51
|
interface ZipOptions {
|
|
@@ -37,7 +37,7 @@ const createRoutes = ({ account, workspace }) => {
|
|
|
37
37
|
};
|
|
38
38
|
return routes;
|
|
39
39
|
};
|
|
40
|
-
const getVendorAndName = ({ id }) => utils_1.removeVersionFromAppId(id);
|
|
40
|
+
const getVendorAndName = ({ id }) => (0, utils_1.removeVersionFromAppId)(id);
|
|
41
41
|
const notFound = (e) => {
|
|
42
42
|
if (e.response && e.response.status === 404) {
|
|
43
43
|
return {};
|
|
@@ -71,6 +71,9 @@ const workspaceFields = [
|
|
|
71
71
|
'version',
|
|
72
72
|
].join(',');
|
|
73
73
|
class Apps extends InfraClient_1.InfraClient {
|
|
74
|
+
get routes() {
|
|
75
|
+
return this._routes;
|
|
76
|
+
}
|
|
74
77
|
constructor(context, options) {
|
|
75
78
|
super('apps@0.x', context, options, true);
|
|
76
79
|
this.installApp = (descriptor, tracingConfig) => {
|
|
@@ -118,7 +121,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
118
121
|
if (indexOfManifest === -1) {
|
|
119
122
|
throw new Error('No manifest.json file found in files.');
|
|
120
123
|
}
|
|
121
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
124
|
+
const zip = (0, archiver_1.default)('zip', { zlib });
|
|
122
125
|
// Throw stream errors so they reject the promise chain.
|
|
123
126
|
zip.on('error', (e) => {
|
|
124
127
|
throw e;
|
|
@@ -140,8 +143,6 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
140
143
|
return response;
|
|
141
144
|
}
|
|
142
145
|
catch (e) {
|
|
143
|
-
// Typing cast for compatibility with error handling in TS versions > 4.0
|
|
144
|
-
// Source: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#unknown-on-catch-clause-bindings
|
|
145
146
|
e.bundleSize = zip.pointer();
|
|
146
147
|
throw e;
|
|
147
148
|
}
|
|
@@ -155,7 +156,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
155
156
|
.filter(change => !change.content)
|
|
156
157
|
.map(change => change.path)
|
|
157
158
|
.join(':');
|
|
158
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
159
|
+
const zip = (0, archiver_1.default)('zip', { zlib });
|
|
159
160
|
// Throw stream errors so they reject the promise chain.
|
|
160
161
|
zip.on('error', (e) => {
|
|
161
162
|
throw e;
|
|
@@ -222,7 +223,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
222
223
|
});
|
|
223
224
|
};
|
|
224
225
|
this.listAppFiles = (app, { prefix, nextMarker } = {}, tracingConfig) => {
|
|
225
|
-
const locator = utils_1.parseAppId(app);
|
|
226
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
226
227
|
const linked = !!locator.build;
|
|
227
228
|
const params = {
|
|
228
229
|
marker: nextMarker,
|
|
@@ -254,11 +255,11 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
254
255
|
};
|
|
255
256
|
this.getAppFile = (app, path, staleIfError, tracingConfig) => {
|
|
256
257
|
const { logger } = this.context;
|
|
257
|
-
const locator = utils_1.parseAppId(app);
|
|
258
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
258
259
|
const linked = !!locator.build;
|
|
259
260
|
const inflightKey = HttpClient_1.inflightURL;
|
|
260
261
|
if (staleIfError && this.memoryCache) {
|
|
261
|
-
appsStaleIfError_1.saveVersion(app, this.memoryCache);
|
|
262
|
+
(0, appsStaleIfError_1.saveVersion)(app, this.memoryCache);
|
|
262
263
|
}
|
|
263
264
|
const metric = linked ? 'apps-get-file' : 'registry-get-file';
|
|
264
265
|
try {
|
|
@@ -275,13 +276,13 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
275
276
|
catch (error) {
|
|
276
277
|
logger.error({ error, message: 'getAppFile failed', app, path });
|
|
277
278
|
if (staleIfError && this.memoryCache) {
|
|
278
|
-
return appsStaleIfError_1.getFallbackFile(app, path, this.memoryCache, this);
|
|
279
|
+
return (0, appsStaleIfError_1.getFallbackFile)(app, path, this.memoryCache, this);
|
|
279
280
|
}
|
|
280
281
|
throw error;
|
|
281
282
|
}
|
|
282
283
|
};
|
|
283
284
|
this.getAppJSON = (app, path, nullIfNotFound, tracingConfig) => {
|
|
284
|
-
const locator = utils_1.parseAppId(app);
|
|
285
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
285
286
|
const linked = !!locator.build;
|
|
286
287
|
const inflightKey = HttpClient_1.inflightURL;
|
|
287
288
|
const metric = linked ? 'apps-get-json' : 'registry-get-json';
|
|
@@ -311,7 +312,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
311
312
|
});
|
|
312
313
|
};
|
|
313
314
|
this.getAppFileStream = (app, path, tracingConfig) => {
|
|
314
|
-
const locator = utils_1.parseAppId(app);
|
|
315
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
315
316
|
const metric = locator.build ? 'apps-get-file-s' : 'registry-get-file-s';
|
|
316
317
|
return this.http.getStream(this.routes.File(locator, path), {
|
|
317
318
|
metric,
|
|
@@ -355,7 +356,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
355
356
|
});
|
|
356
357
|
};
|
|
357
358
|
this.getAppBundle = (app, bundlePath, generatePackageJson, tracingConfig) => {
|
|
358
|
-
const locator = utils_1.parseAppId(app);
|
|
359
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
359
360
|
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
360
361
|
const metric = locator.build ? 'apps-get-bundle' : 'registry-get-bundle';
|
|
361
362
|
return this.http.getStream(this.routes.AppBundle(locator, bundlePath), {
|
|
@@ -374,15 +375,15 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
374
375
|
this.unpackAppBundle = (app, bundlePath, unpackPath, generatePackageJson, tracingConfig) => {
|
|
375
376
|
return this.getAppBundle(app, bundlePath, generatePackageJson, tracingConfig)
|
|
376
377
|
.then(stream => stream
|
|
377
|
-
.pipe(zlib_1.createGunzip())
|
|
378
|
-
.pipe(tar_fs_1.extract(unpackPath)));
|
|
378
|
+
.pipe((0, zlib_1.createGunzip)())
|
|
379
|
+
.pipe((0, tar_fs_1.extract)(unpackPath)));
|
|
379
380
|
};
|
|
380
381
|
this.getAppsMetaInfos = async (filter, staleWhileRevalidate = true, tracingConfig) => {
|
|
381
382
|
var _a;
|
|
382
383
|
const { account, production, recorder, workspace, logger } = this.context;
|
|
383
384
|
const metric = 'get-apps-meta';
|
|
384
385
|
const inflightKey = HttpClient_1.inflightURL;
|
|
385
|
-
const key = appsStaleIfError_1.getMetaInfoKey(account, workspace);
|
|
386
|
+
const key = (0, appsStaleIfError_1.getMetaInfoKey)(account, workspace);
|
|
386
387
|
const cachedResponse = production && staleWhileRevalidate
|
|
387
388
|
? await ((_a = this.diskCache) === null || _a === void 0 ? void 0 : _a.get(key))
|
|
388
389
|
: undefined;
|
|
@@ -504,8 +505,5 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
504
505
|
this.memoryCache = options && options.memoryCache;
|
|
505
506
|
this._routes = createRoutes(context);
|
|
506
507
|
}
|
|
507
|
-
get routes() {
|
|
508
|
-
return this._routes;
|
|
509
|
-
}
|
|
510
508
|
}
|
|
511
509
|
exports.Apps = Apps;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Readable } from 'stream';
|
|
3
4
|
import { AppMetaInfo } from '../..';
|
|
4
5
|
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
@@ -20,14 +21,14 @@ export declare class Assets extends InfraClient {
|
|
|
20
21
|
headers: any;
|
|
21
22
|
}>;
|
|
22
23
|
getFilteredDependencies(apps: string | string[], dependencies: AppMetaInfo[]): AppMetaInfo[];
|
|
23
|
-
getAppBundleByVendor: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig
|
|
24
|
-
protected getAppJSONByAccount: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean
|
|
25
|
-
protected getAppJSONByVendor: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean
|
|
26
|
-
protected getAppFileByAccount: (app: string, path: string, nullIfNotFound?: boolean
|
|
24
|
+
getAppBundleByVendor: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig) => Promise<Readable>;
|
|
25
|
+
protected getAppJSONByAccount: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<T>;
|
|
26
|
+
protected getAppJSONByVendor: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<T>;
|
|
27
|
+
protected getAppFileByAccount: (app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
27
28
|
data: Buffer;
|
|
28
29
|
headers: any;
|
|
29
30
|
}>;
|
|
30
|
-
protected getAppFileByVendor: (app: string, path: string, nullIfNotFound?: boolean
|
|
31
|
+
protected getAppFileByVendor: (app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
31
32
|
data: Buffer;
|
|
32
33
|
headers: any;
|
|
33
34
|
}>;
|
|
@@ -22,7 +22,7 @@ const dependsOnApp = (appsAtMajor) => (a) => {
|
|
|
22
22
|
};
|
|
23
23
|
const useBuildJson = (app, appVendorName) => {
|
|
24
24
|
const buildFeatures = app._buildFeatures;
|
|
25
|
-
return buildFeatures && buildFeatures[appVendorName] && ramda_1.contains('build.json', buildFeatures[appVendorName]);
|
|
25
|
+
return buildFeatures && buildFeatures[appVendorName] && (0, ramda_1.contains)('build.json', buildFeatures[appVendorName]);
|
|
26
26
|
};
|
|
27
27
|
const appOrRegistry = (workspace, { name, version, build }) => build
|
|
28
28
|
? `${workspace}/apps/${name}@${version}+${build}`
|
|
@@ -35,7 +35,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
35
35
|
constructor(context, options) {
|
|
36
36
|
super('apps@0.x', context, options, true);
|
|
37
37
|
this.getAppBundleByVendor = (app, bundlePath, generatePackageJson, tracingConfig) => {
|
|
38
|
-
const locator = utils_1.parseAppId(app);
|
|
38
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
39
39
|
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
40
40
|
const metric = locator.build ? 'apps-get-bundle' : 'registry-get-bundle';
|
|
41
41
|
return this.http.getStream(this.routes.Bundle(this.context.account, locator, bundlePath), {
|
|
@@ -52,7 +52,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
this.getAppJSONByAccount = (app, path, nullIfNotFound, tracingConfig) => {
|
|
55
|
-
const locator = utils_1.parseAppId(app);
|
|
55
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
56
56
|
const inflightKey = HttpClient_1.inflightURL;
|
|
57
57
|
const metric = 'assets-get-json-by-account';
|
|
58
58
|
return this.http.get(this.routes.Files(this.context.account, locator, path), {
|
|
@@ -67,7 +67,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
69
|
this.getAppJSONByVendor = (app, path, nullIfNotFound, tracingConfig) => {
|
|
70
|
-
const locator = utils_1.parseAppId(app);
|
|
70
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
71
71
|
const vendor = locator.name.split('.')[0];
|
|
72
72
|
const inflightKey = HttpClient_1.inflightURL;
|
|
73
73
|
const metric = 'assets-get-json-by-vendor';
|
|
@@ -83,7 +83,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
this.getAppFileByAccount = (app, path, nullIfNotFound, tracingConfig) => {
|
|
86
|
-
const locator = utils_1.parseAppId(app);
|
|
86
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
87
87
|
const inflightKey = HttpClient_1.inflightURL;
|
|
88
88
|
const metric = 'assets-get-file-by-account';
|
|
89
89
|
return this.http.getBuffer(this.routes.Files(this.context.account, locator, path), {
|
|
@@ -98,7 +98,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
this.getAppFileByVendor = (app, path, nullIfNotFound, tracingConfig) => {
|
|
101
|
-
const locator = utils_1.parseAppId(app);
|
|
101
|
+
const locator = (0, utils_1.parseAppId)(app);
|
|
102
102
|
const vendor = locator.name.split('.')[0];
|
|
103
103
|
const inflightKey = HttpClient_1.inflightURL;
|
|
104
104
|
const metric = 'assets-get-file-by-vendor';
|
|
@@ -129,7 +129,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
129
129
|
async getBuildJSONForApp(app, appVendorName, pick = [], tracingConfig) {
|
|
130
130
|
const pickArray = Array.isArray(pick) ? pick : [pick];
|
|
131
131
|
const buildJson = await this.getJSON(app.id, `dist/${appVendorName}/build.json`, undefined, tracingConfig);
|
|
132
|
-
const result = !ramda_1.isEmpty(pickArray) ? ramda_1.pick(pickArray, buildJson) : buildJson;
|
|
132
|
+
const result = !(0, ramda_1.isEmpty)(pickArray) ? (0, ramda_1.pick)(pickArray, buildJson) : buildJson;
|
|
133
133
|
result.declarer = app.id;
|
|
134
134
|
return result;
|
|
135
135
|
}
|
|
@@ -137,12 +137,12 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
137
137
|
// If there's no support for build.json, then fetch individual files and zip them into an {[file]: content} object.
|
|
138
138
|
const filesArray = Array.isArray(files) ? files : [files];
|
|
139
139
|
const fetched = await Promise.all(filesArray.map(file => this.getJSON(app.id, file, true, tracingConfig)));
|
|
140
|
-
const result = ramda_1.zipObj(filesArray, fetched);
|
|
140
|
+
const result = (0, ramda_1.zipObj)(filesArray, fetched);
|
|
141
141
|
result.declarer = app.id;
|
|
142
142
|
return result;
|
|
143
143
|
}
|
|
144
144
|
async getJSON(appId, file, nullIfNotFound, tracingConfig) {
|
|
145
|
-
const locator = utils_1.parseAppId(appId);
|
|
145
|
+
const locator = (0, utils_1.parseAppId)(appId);
|
|
146
146
|
const linked = !!locator.build;
|
|
147
147
|
if (linked) {
|
|
148
148
|
return this.getAppJSONByAccount(appId, file, nullIfNotFound, tracingConfig);
|
|
@@ -150,7 +150,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
150
150
|
return this.getAppJSONByVendor(appId, file, nullIfNotFound, tracingConfig);
|
|
151
151
|
}
|
|
152
152
|
async getFile(appId, file, nullIfNotFound, tracingConfig) {
|
|
153
|
-
const locator = utils_1.parseAppId(appId);
|
|
153
|
+
const locator = (0, utils_1.parseAppId)(appId);
|
|
154
154
|
const linked = !!locator.build;
|
|
155
155
|
if (linked) {
|
|
156
156
|
return this.getAppFileByAccount(appId, file, nullIfNotFound, tracingConfig);
|
|
@@ -160,7 +160,7 @@ class Assets extends InfraClient_1.InfraClient {
|
|
|
160
160
|
getFilteredDependencies(apps, dependencies) {
|
|
161
161
|
const appsAtMajor = typeof (apps) === 'string' ? [apps] : apps;
|
|
162
162
|
const depends = dependsOnApp(appsAtMajor);
|
|
163
|
-
return ramda_1.filter(depends, dependencies);
|
|
163
|
+
return (0, ramda_1.filter)(depends, dependencies);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
exports.Assets = Assets;
|
|
@@ -3,7 +3,7 @@ import { IOContext } from '../../service/worker/runtime/typings';
|
|
|
3
3
|
import { InfraClient } from './InfraClient';
|
|
4
4
|
export declare class BillingMetrics extends InfraClient {
|
|
5
5
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
6
|
-
sendMetric: (metric: BillingMetric, tracingConfig?: RequestTracingConfig
|
|
6
|
+
sendMetric: (metric: BillingMetric, tracingConfig?: RequestTracingConfig) => Promise<BillingMetric>;
|
|
7
7
|
}
|
|
8
8
|
export interface BillingMetric {
|
|
9
9
|
value: number;
|
|
@@ -3,7 +3,7 @@ import { IOContext } from '../../service/worker/runtime/typings';
|
|
|
3
3
|
import { InfraClient } from './InfraClient';
|
|
4
4
|
export declare class Events extends InfraClient {
|
|
5
5
|
constructor({ recorder, ...context }: IOContext, options?: InstanceOptions);
|
|
6
|
-
sendEvent: (appIdOrResource: string | ResourceVRN, route: string, message?: any, tracingConfig?: RequestTracingConfig
|
|
6
|
+
sendEvent: (appIdOrResource: string | ResourceVRN, route: string, message?: any, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
7
7
|
private resourceFor;
|
|
8
8
|
}
|
|
9
9
|
export interface ResourceVRN {
|
|
@@ -5,7 +5,7 @@ const util_1 = require("util");
|
|
|
5
5
|
const InfraClient_1 = require("./InfraClient");
|
|
6
6
|
const ANY_APP = '';
|
|
7
7
|
const eventRoute = (route) => `/events/${route}`;
|
|
8
|
-
const isResourceVRN = (appIdOrResource) => util_1.isObject(appIdOrResource) && !util_1.isNullOrUndefined(appIdOrResource.service);
|
|
8
|
+
const isResourceVRN = (appIdOrResource) => (0, util_1.isObject)(appIdOrResource) && !(0, util_1.isNullOrUndefined)(appIdOrResource.service);
|
|
9
9
|
class Events extends InfraClient_1.InfraClient {
|
|
10
10
|
constructor({ recorder, ...context }, options) {
|
|
11
11
|
super('courier@0.x', context, options);
|
|
@@ -4,7 +4,7 @@ import { IOContext } from '../../service/worker/runtime/typings';
|
|
|
4
4
|
import { InfraClient } from './InfraClient';
|
|
5
5
|
export declare class Housekeeper extends InfraClient {
|
|
6
6
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
7
|
-
apply: (data: HousekeeperStatesAndUpdates, tracingConfig?: RequestTracingConfig
|
|
8
|
-
perform: (tracingConfig?: RequestTracingConfig
|
|
9
|
-
resolve: (tracingConfig?: RequestTracingConfig
|
|
7
|
+
apply: (data: HousekeeperStatesAndUpdates, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
8
|
+
perform: (tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
9
|
+
resolve: (tracingConfig?: RequestTracingConfig) => Promise<HousekeeperStatesAndUpdates>;
|
|
10
10
|
}
|
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
2
4
|
import { IncomingMessage } from 'http';
|
|
3
5
|
import { Readable, Writable } from 'stream';
|
|
4
6
|
import { ZlibOptions } from 'zlib';
|
|
5
7
|
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
6
|
-
import {
|
|
8
|
+
import { AppFilesList, AppManifest, AppState } from '../../responses';
|
|
7
9
|
import { IOContext } from '../../service/worker/runtime/typings';
|
|
8
10
|
import { InfraClient } from './InfraClient';
|
|
9
11
|
export declare class Registry extends InfraClient {
|
|
10
12
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
11
|
-
getAppState: (app: string, version: string, tracingConfig?: RequestTracingConfig
|
|
12
|
-
publishApp: (files: File[], tag?: string
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
getAppState: (app: string, version: string, tracingConfig?: RequestTracingConfig) => Promise<AppState>;
|
|
14
|
+
publishApp: (files: File[], tag?: string, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig) => Promise<import("../../responses").AppBundleResponse & {
|
|
15
|
+
bundleSize?: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
publishAppRc: (files: File[], tag?: string, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig) => Promise<import("../../responses").AppBundleResponse & {
|
|
18
|
+
bundleSize?: number | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
listApps: (tracingConfig?: RequestTracingConfig) => Promise<RegistryAppsList>;
|
|
21
|
+
listVersionsByApp: (app: string, tracingConfig?: RequestTracingConfig) => Promise<RegistryAppVersionsList>;
|
|
22
|
+
deprecateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
23
|
+
undeprecateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
24
|
+
validateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
25
|
+
getAppManifest: (app: string, version: string, opts?: AppsManifestOptions, tracingConfig?: RequestTracingConfig) => Promise<AppManifest>;
|
|
26
|
+
listAppFiles: (app: string, version: string, opts?: ListAppFilesOptions, tracingConfig?: RequestTracingConfig) => Promise<AppFilesList>;
|
|
27
|
+
getAppFile: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
22
28
|
data: Buffer;
|
|
23
29
|
headers: any;
|
|
24
30
|
}>;
|
|
25
|
-
getAppJSON: <T extends object | null>(app: string, version: string, path: string, nullIfNotFound?: boolean
|
|
26
|
-
getAppFileStream: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig
|
|
27
|
-
getAppBundle: (app: string, version: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig
|
|
28
|
-
unpackAppBundle: (app: string, version: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig
|
|
29
|
-
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig
|
|
31
|
+
getAppJSON: <T extends object | null>(app: string, version: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<T>;
|
|
32
|
+
getAppFileStream: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig) => Promise<IncomingMessage>;
|
|
33
|
+
getAppBundle: (app: string, version: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig) => Promise<Readable>;
|
|
34
|
+
unpackAppBundle: (app: string, version: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig) => Promise<Writable>;
|
|
35
|
+
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig) => Promise<Record<string, string[]>>;
|
|
30
36
|
private publish;
|
|
31
37
|
}
|
|
32
38
|
interface ZipOptions {
|
|
@@ -157,8 +157,8 @@ class Registry extends InfraClient_1.InfraClient {
|
|
|
157
157
|
this.unpackAppBundle = (app, version, bundlePath, unpackPath, generatePackageJson, tracingConfig) => {
|
|
158
158
|
return this.getAppBundle(app, version, bundlePath, generatePackageJson, tracingConfig)
|
|
159
159
|
.then(stream => stream
|
|
160
|
-
.pipe(zlib_1.createGunzip())
|
|
161
|
-
.pipe(tar_fs_1.extract(unpackPath)));
|
|
160
|
+
.pipe((0, zlib_1.createGunzip)())
|
|
161
|
+
.pipe((0, tar_fs_1.extract)(unpackPath)));
|
|
162
162
|
};
|
|
163
163
|
this.resolveDependenciesWithManifest = (manifest, filter = '', tracingConfig) => {
|
|
164
164
|
const params = { filter };
|
|
@@ -176,7 +176,7 @@ class Registry extends InfraClient_1.InfraClient {
|
|
|
176
176
|
if (indexOfManifest === -1) {
|
|
177
177
|
throw new Error('No manifest.json file found in files.');
|
|
178
178
|
}
|
|
179
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
179
|
+
const zip = (0, archiver_1.default)('zip', { zlib });
|
|
180
180
|
// Throw stream errors so they reject the promise chain.
|
|
181
181
|
zip.on('error', (e) => {
|
|
182
182
|
throw e;
|
|
@@ -199,7 +199,6 @@ class Registry extends InfraClient_1.InfraClient {
|
|
|
199
199
|
return response;
|
|
200
200
|
}
|
|
201
201
|
catch (e) {
|
|
202
|
-
// See Apps.ts `link` method for more information on this cast
|
|
203
202
|
e.bundleSize = zip.pointer();
|
|
204
203
|
throw e;
|
|
205
204
|
}
|
|
@@ -3,13 +3,13 @@ import { IOContext } from '../../service/worker/runtime/typings';
|
|
|
3
3
|
import { InfraClient } from './InfraClient';
|
|
4
4
|
export declare class Router extends InfraClient {
|
|
5
5
|
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
6
|
-
listAvailableIoVersions: (tracingConfig?: RequestTracingConfig
|
|
7
|
-
getInstalledIoVersion: (tracingConfig?: RequestTracingConfig
|
|
8
|
-
installIo: (version: string, tracingConfig?: RequestTracingConfig
|
|
9
|
-
listAvailableServices: (tracingConfig?: RequestTracingConfig
|
|
10
|
-
getAvailableVersions: (name: string, tracingConfig?: RequestTracingConfig
|
|
11
|
-
listInstalledServices: (tracingConfig?: RequestTracingConfig
|
|
12
|
-
installService: (name: string, version: string, tracingConfig?: RequestTracingConfig
|
|
6
|
+
listAvailableIoVersions: (tracingConfig?: RequestTracingConfig) => Promise<AvaiableIO[]>;
|
|
7
|
+
getInstalledIoVersion: (tracingConfig?: RequestTracingConfig) => Promise<AvaiableIO>;
|
|
8
|
+
installIo: (version: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
9
|
+
listAvailableServices: (tracingConfig?: RequestTracingConfig) => Promise<AvailableServices>;
|
|
10
|
+
getAvailableVersions: (name: string, tracingConfig?: RequestTracingConfig) => Promise<AvailableServiceVersions>;
|
|
11
|
+
listInstalledServices: (tracingConfig?: RequestTracingConfig) => Promise<InstalledService[]>;
|
|
12
|
+
installService: (name: string, version: string, tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
export interface AvaiableIO {
|
|
15
15
|
version: string;
|
|
@@ -18,7 +18,7 @@ export interface AvaiableIO {
|
|
|
18
18
|
[service: string]: string;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export type InstalledIO = AvaiableIO;
|
|
22
22
|
export interface AvailableServiceVersions {
|
|
23
23
|
versions: {
|
|
24
24
|
[region: string]: string[];
|