@vtex/api 6.48.1-beta.2 → 6.48.1-beta.3
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/lib/HttpClient/GraphQLClient.d.ts +1 -1
- package/lib/HttpClient/HttpClient.d.ts +2 -3
- package/lib/HttpClient/HttpClient.js +14 -14
- package/lib/HttpClient/agents.d.ts +2 -5
- package/lib/HttpClient/agents.js +4 -10
- package/lib/HttpClient/index.js +2 -7
- package/lib/HttpClient/middlewares/cache.d.ts +1 -1
- package/lib/HttpClient/middlewares/cache.js +36 -38
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +1 -2
- package/lib/HttpClient/middlewares/inflight.d.ts +1 -1
- package/lib/HttpClient/middlewares/inflight.js +3 -6
- package/lib/HttpClient/middlewares/memoization.d.ts +1 -1
- package/lib/HttpClient/middlewares/memoization.js +8 -9
- package/lib/HttpClient/middlewares/metrics.js +7 -8
- package/lib/HttpClient/middlewares/notFound.d.ts +1 -1
- package/lib/HttpClient/middlewares/notFound.js +2 -4
- package/lib/HttpClient/middlewares/recorder.js +1 -2
- 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 +10 -13
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +1 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +4 -5
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +5 -6
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +0 -1
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +8 -8
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +8 -10
- package/lib/HttpClient/middlewares/tracing.js +10 -11
- package/lib/HttpClient/typings.d.ts +2 -2
- package/lib/caches/DiskCache.js +2 -2
- package/lib/caches/LRUCache.d.ts +2 -2
- package/lib/caches/LRUDiskCache.d.ts +1 -1
- package/lib/caches/LRUDiskCache.js +2 -2
- package/lib/caches/MultilayeredCache.d.ts +2 -2
- package/lib/caches/MultilayeredCache.js +6 -6
- package/lib/caches/index.js +2 -6
- 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 +2 -6
- package/lib/clients/external/ID.d.ts +4 -4
- package/lib/clients/external/PaymentProvider.d.ts +2 -2
- package/lib/clients/external/index.js +2 -6
- package/lib/clients/index.js +2 -6
- package/lib/clients/infra/Apps.d.ts +27 -32
- package/lib/clients/infra/Apps.js +16 -16
- package/lib/clients/infra/Assets.d.ts +5 -6
- 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 +17 -23
- package/lib/clients/infra/Registry.js +3 -3
- 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 +14 -15
- package/lib/clients/infra/VBase.js +2 -2
- package/lib/clients/infra/Workspaces.d.ts +7 -7
- package/lib/clients/infra/index.js +2 -6
- 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 +2 -6
- package/lib/constants.d.ts +1 -1
- package/lib/constants.js +1 -1
- package/lib/errors/ResolverError.js +1 -1
- package/lib/errors/index.js +2 -6
- package/lib/index.js +2 -6
- 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 +6 -7
- package/lib/service/loaders.js +6 -8
- package/lib/service/logger/console.js +4 -7
- package/lib/service/logger/index.js +2 -6
- package/lib/service/logger/logger.js +2 -2
- package/lib/service/logger/metricsLogger.js +10 -10
- package/lib/service/master.js +6 -7
- package/lib/service/metrics/requestMetricsMiddleware.js +13 -14
- package/lib/service/tracing/TracerSingleton.js +9 -9
- package/lib/service/tracing/metrics/MetricNames.js +12 -12
- package/lib/service/tracing/metrics/instruments.js +7 -14
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +5 -5
- package/lib/service/tracing/tracingMiddlewares.js +15 -18
- package/lib/service/worker/index.js +23 -24
- package/lib/service/worker/listeners.js +1 -2
- package/lib/service/worker/runtime/Service.js +1 -1
- package/lib/service/worker/runtime/builtIn/handlers.js +3 -6
- package/lib/service/worker/runtime/builtIn/middlewares.js +3 -5
- package/lib/service/worker/runtime/events/index.d.ts +1 -1
- package/lib/service/worker/runtime/events/index.js +10 -11
- package/lib/service/worker/runtime/events/middlewares/body.js +2 -2
- package/lib/service/worker/runtime/events/middlewares/context.js +1 -1
- package/lib/service/worker/runtime/events/router.js +2 -3
- package/lib/service/worker/runtime/graphql/index.js +7 -8
- package/lib/service/worker/runtime/graphql/middlewares/error.js +5 -5
- package/lib/service/worker/runtime/graphql/middlewares/query.js +6 -7
- package/lib/service/worker/runtime/graphql/middlewares/response.js +1 -1
- package/lib/service/worker/runtime/graphql/middlewares/run.js +2 -3
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +3 -4
- 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 +7 -8
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +2 -2
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +3 -4
- 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 +1 -2
- 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 +1 -2
- package/lib/service/worker/runtime/graphql/utils/error.js +9 -10
- package/lib/service/worker/runtime/graphql/utils/pathname.js +2 -3
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +1 -1
- package/lib/service/worker/runtime/graphql/utils/translations.js +4 -7
- package/lib/service/worker/runtime/http/index.d.ts +2 -2
- package/lib/service/worker/runtime/http/index.js +20 -22
- package/lib/service/worker/runtime/http/middlewares/context.js +5 -7
- 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 +9 -13
- package/lib/service/worker/runtime/http/middlewares/timings.js +3 -3
- package/lib/service/worker/runtime/http/router.js +2 -3
- package/lib/service/worker/runtime/http/routes.js +5 -8
- 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 +5 -10
- 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 +2 -4
- package/lib/service/worker/runtime/utils/context.d.ts +2 -2
- package/lib/service/worker/runtime/utils/context.js +4 -5
- package/lib/service/worker/runtime/utils/recorder.js +1 -1
- package/lib/service/worker/runtime/utils/toArray.js +1 -2
- package/lib/tracing/UserLandTracer.js +2 -3
- package/lib/tracing/errorReporting/ErrorReport.js +13 -13
- package/lib/tracing/index.js +1 -1
- package/lib/tracing/utils.js +4 -5
- package/lib/utils/MineWinsConflictsResolver.d.ts +4 -4
- package/lib/utils/MineWinsConflictsResolver.js +10 -10
- package/lib/utils/app.js +23 -39
- package/lib/utils/appsStaleIfError.d.ts +0 -1
- package/lib/utils/appsStaleIfError.js +9 -17
- package/lib/utils/billingOptions.js +1 -2
- package/lib/utils/binding.js +2 -4
- package/lib/utils/buildFullPath.d.ts +11 -0
- package/lib/utils/buildFullPath.js +54 -0
- package/lib/utils/domain.js +1 -1
- package/lib/utils/error.js +4 -5
- package/lib/utils/index.js +2 -6
- package/lib/utils/log.js +2 -3
- package/lib/utils/message.js +5 -8
- package/lib/utils/renameBy.js +1 -2
- package/lib/utils/retry.js +6 -8
- package/lib/utils/status.js +1 -2
- package/lib/utils/tenant.js +2 -4
- package/lib/utils/time.d.ts +1 -1
- package/lib/utils/time.js +14 -23
- package/package.json +2 -2
|
@@ -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(
|
|
38
|
+
.then(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(
|
|
59
|
+
.then(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(
|
|
73
|
+
.then(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(
|
|
86
|
+
.then(ramda_1.prop('data'));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
exports.CatalogGraphQL = CatalogGraphQL;
|
|
@@ -1,17 +1,13 @@
|
|
|
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
|
-
|
|
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);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
12
8
|
}));
|
|
13
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
15
11
|
};
|
|
16
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
13
|
__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) => 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>;
|
|
6
|
+
getTemporaryToken: (tracingConfig?: RequestTracingConfig | undefined) => Promise<string>;
|
|
7
|
+
sendCodeToEmail: (token: string, email: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<any>;
|
|
8
|
+
getEmailCodeAuthenticationToken: (token: string, email: string, code: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<AuthenticationResponse>;
|
|
9
|
+
getPasswordAuthenticationToken: (token: string, email: string, password: string, tracingConfig?: RequestTracingConfig | undefined) => 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) => Promise<unknown>;
|
|
8
|
-
inbound: <TRequest, TResponse>(transactionId: string, paymentId: string, action: string, payload: TRequest, tracingConfig?: RequestTracingConfig) => Promise<TResponse>;
|
|
7
|
+
callback: (transactionId: string, paymentId: string, callback: AuthorizationCallback, tracingConfig?: RequestTracingConfig | undefined) => Promise<unknown>;
|
|
8
|
+
inbound: <TRequest, TResponse>(transactionId: string, paymentId: string, action: string, payload: TRequest, tracingConfig?: RequestTracingConfig | undefined) => Promise<TResponse>;
|
|
9
9
|
}
|
|
10
10
|
export interface AuthorizationCallback {
|
|
11
11
|
paymentId: string;
|
|
@@ -1,17 +1,13 @@
|
|
|
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
|
-
|
|
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);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
12
8
|
}));
|
|
13
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
15
11
|
};
|
|
16
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
13
|
__exportStar(require("./ExternalClient"), exports);
|
package/lib/clients/index.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
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
|
-
|
|
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);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
12
8
|
}));
|
|
13
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
15
11
|
};
|
|
16
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
2
|
import { IncomingMessage } from 'http';
|
|
6
3
|
import { Readable, Writable } from 'stream';
|
|
7
4
|
import { ZlibOptions } from 'zlib';
|
|
8
5
|
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
9
|
-
import { AppFilesList, AppManifest } from '../../responses';
|
|
6
|
+
import { AppBundleLinked, AppFilesList, AppManifest } from '../../responses';
|
|
10
7
|
import { IOContext } from '../../service/worker/runtime/typings';
|
|
11
8
|
import { InfraClient } from './InfraClient';
|
|
12
9
|
export declare class Apps extends InfraClient {
|
|
@@ -15,37 +12,35 @@ export declare class Apps extends InfraClient {
|
|
|
15
12
|
private memoryCache;
|
|
16
13
|
private get routes();
|
|
17
14
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
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<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
listLinks: (tracingConfig?: RequestTracingConfig) => Promise<string[]>;
|
|
31
|
-
getAppFile: (app: string, path: string, staleIfError?: boolean, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
15
|
+
installApp: (descriptor: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void> | Promise<AppInstallResponse>;
|
|
16
|
+
uninstallApp: (app: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<import("../..").IOResponse<void>>;
|
|
17
|
+
acknowledgeApp: (app: string, service: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
18
|
+
link: (app: string, files: Change[], { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppBundleLinked>;
|
|
19
|
+
patch: (app: string, changes: Change[], { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
20
|
+
unlink: (app: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<import("../..").IOResponse<void>>;
|
|
21
|
+
unlinkAll: (tracingConfig?: RequestTracingConfig | undefined) => Promise<import("../..").IOResponse<void>>;
|
|
22
|
+
saveAppSettings: (app: string, settings: any, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
23
|
+
listApps: ({ oldVersion, since, service }?: ListAppsOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppsList>;
|
|
24
|
+
listAppFiles: (app: string, { prefix, nextMarker }?: ListFilesOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppFilesList>;
|
|
25
|
+
listLinks: (tracingConfig?: RequestTracingConfig | undefined) => Promise<string[]>;
|
|
26
|
+
getAppFile: (app: string, path: string, staleIfError?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
32
27
|
data: Buffer;
|
|
33
28
|
headers: any;
|
|
34
29
|
}>;
|
|
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[]>>;
|
|
30
|
+
getAppJSON: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
31
|
+
getFileFromApps: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
32
|
+
getAppFileStream: (app: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<IncomingMessage>;
|
|
33
|
+
getApp: (app: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppManifest>;
|
|
34
|
+
getAppSettings: (app: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<any>;
|
|
35
|
+
getAllAppsSettings: (listAppsOptions?: ListAppsOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppsSettings>;
|
|
36
|
+
getAppBundle: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Readable>;
|
|
37
|
+
unpackAppBundle: (app: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Writable>;
|
|
38
|
+
getAppsMetaInfos: (filter?: string | undefined, staleWhileRevalidate?: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppMetaInfo[]>;
|
|
39
|
+
getDependencies: (filter?: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<Record<string, string[]>>;
|
|
40
|
+
updateDependencies: (tracingConfig?: RequestTracingConfig | undefined) => Promise<Record<string, string[]>>;
|
|
41
|
+
updateDependency: (name: string, version: string, registry: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
42
|
+
resolveDependencies: (apps: string[], registries: string[], filter?: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<any>;
|
|
43
|
+
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<Record<string, string[]>>;
|
|
49
44
|
private installRuntime;
|
|
50
45
|
}
|
|
51
46
|
interface ZipOptions {
|
|
@@ -37,7 +37,7 @@ const createRoutes = ({ account, workspace }) => {
|
|
|
37
37
|
};
|
|
38
38
|
return routes;
|
|
39
39
|
};
|
|
40
|
-
const getVendorAndName = ({ id }) =>
|
|
40
|
+
const getVendorAndName = ({ id }) => utils_1.removeVersionFromAppId(id);
|
|
41
41
|
const notFound = (e) => {
|
|
42
42
|
if (e.response && e.response.status === 404) {
|
|
43
43
|
return {};
|
|
@@ -71,9 +71,6 @@ const workspaceFields = [
|
|
|
71
71
|
'version',
|
|
72
72
|
].join(',');
|
|
73
73
|
class Apps extends InfraClient_1.InfraClient {
|
|
74
|
-
get routes() {
|
|
75
|
-
return this._routes;
|
|
76
|
-
}
|
|
77
74
|
constructor(context, options) {
|
|
78
75
|
super('apps@0.x', context, options, true);
|
|
79
76
|
this.installApp = (descriptor, tracingConfig) => {
|
|
@@ -121,7 +118,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
121
118
|
if (indexOfManifest === -1) {
|
|
122
119
|
throw new Error('No manifest.json file found in files.');
|
|
123
120
|
}
|
|
124
|
-
const zip =
|
|
121
|
+
const zip = archiver_1.default('zip', { zlib });
|
|
125
122
|
// Throw stream errors so they reject the promise chain.
|
|
126
123
|
zip.on('error', (e) => {
|
|
127
124
|
throw e;
|
|
@@ -158,7 +155,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
158
155
|
.filter(change => !change.content)
|
|
159
156
|
.map(change => change.path)
|
|
160
157
|
.join(':');
|
|
161
|
-
const zip =
|
|
158
|
+
const zip = archiver_1.default('zip', { zlib });
|
|
162
159
|
// Throw stream errors so they reject the promise chain.
|
|
163
160
|
zip.on('error', (e) => {
|
|
164
161
|
throw e;
|
|
@@ -225,7 +222,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
225
222
|
});
|
|
226
223
|
};
|
|
227
224
|
this.listAppFiles = (app, { prefix, nextMarker } = {}, tracingConfig) => {
|
|
228
|
-
const locator =
|
|
225
|
+
const locator = utils_1.parseAppId(app);
|
|
229
226
|
const linked = !!locator.build;
|
|
230
227
|
const params = {
|
|
231
228
|
marker: nextMarker,
|
|
@@ -257,11 +254,11 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
257
254
|
};
|
|
258
255
|
this.getAppFile = (app, path, staleIfError, tracingConfig) => {
|
|
259
256
|
const { logger } = this.context;
|
|
260
|
-
const locator =
|
|
257
|
+
const locator = utils_1.parseAppId(app);
|
|
261
258
|
const linked = !!locator.build;
|
|
262
259
|
const inflightKey = HttpClient_1.inflightURL;
|
|
263
260
|
if (staleIfError && this.memoryCache) {
|
|
264
|
-
|
|
261
|
+
appsStaleIfError_1.saveVersion(app, this.memoryCache);
|
|
265
262
|
}
|
|
266
263
|
const metric = linked ? 'apps-get-file' : 'registry-get-file';
|
|
267
264
|
try {
|
|
@@ -278,13 +275,13 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
278
275
|
catch (error) {
|
|
279
276
|
logger.error({ error, message: 'getAppFile failed', app, path });
|
|
280
277
|
if (staleIfError && this.memoryCache) {
|
|
281
|
-
return
|
|
278
|
+
return appsStaleIfError_1.getFallbackFile(app, path, this.memoryCache, this);
|
|
282
279
|
}
|
|
283
280
|
throw error;
|
|
284
281
|
}
|
|
285
282
|
};
|
|
286
283
|
this.getAppJSON = (app, path, nullIfNotFound, tracingConfig) => {
|
|
287
|
-
const locator =
|
|
284
|
+
const locator = utils_1.parseAppId(app);
|
|
288
285
|
const linked = !!locator.build;
|
|
289
286
|
const inflightKey = HttpClient_1.inflightURL;
|
|
290
287
|
const metric = linked ? 'apps-get-json' : 'registry-get-json';
|
|
@@ -314,7 +311,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
314
311
|
});
|
|
315
312
|
};
|
|
316
313
|
this.getAppFileStream = (app, path, tracingConfig) => {
|
|
317
|
-
const locator =
|
|
314
|
+
const locator = utils_1.parseAppId(app);
|
|
318
315
|
const metric = locator.build ? 'apps-get-file-s' : 'registry-get-file-s';
|
|
319
316
|
return this.http.getStream(this.routes.File(locator, path), {
|
|
320
317
|
metric,
|
|
@@ -358,7 +355,7 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
358
355
|
});
|
|
359
356
|
};
|
|
360
357
|
this.getAppBundle = (app, bundlePath, generatePackageJson, tracingConfig) => {
|
|
361
|
-
const locator =
|
|
358
|
+
const locator = utils_1.parseAppId(app);
|
|
362
359
|
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
363
360
|
const metric = locator.build ? 'apps-get-bundle' : 'registry-get-bundle';
|
|
364
361
|
return this.http.getStream(this.routes.AppBundle(locator, bundlePath), {
|
|
@@ -377,15 +374,15 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
377
374
|
this.unpackAppBundle = (app, bundlePath, unpackPath, generatePackageJson, tracingConfig) => {
|
|
378
375
|
return this.getAppBundle(app, bundlePath, generatePackageJson, tracingConfig)
|
|
379
376
|
.then(stream => stream
|
|
380
|
-
.pipe(
|
|
381
|
-
.pipe(
|
|
377
|
+
.pipe(zlib_1.createGunzip())
|
|
378
|
+
.pipe(tar_fs_1.extract(unpackPath)));
|
|
382
379
|
};
|
|
383
380
|
this.getAppsMetaInfos = async (filter, staleWhileRevalidate = true, tracingConfig) => {
|
|
384
381
|
var _a;
|
|
385
382
|
const { account, production, recorder, workspace, logger } = this.context;
|
|
386
383
|
const metric = 'get-apps-meta';
|
|
387
384
|
const inflightKey = HttpClient_1.inflightURL;
|
|
388
|
-
const key =
|
|
385
|
+
const key = appsStaleIfError_1.getMetaInfoKey(account, workspace);
|
|
389
386
|
const cachedResponse = production && staleWhileRevalidate
|
|
390
387
|
? await ((_a = this.diskCache) === null || _a === void 0 ? void 0 : _a.get(key))
|
|
391
388
|
: undefined;
|
|
@@ -507,5 +504,8 @@ class Apps extends InfraClient_1.InfraClient {
|
|
|
507
504
|
this.memoryCache = options && options.memoryCache;
|
|
508
505
|
this._routes = createRoutes(context);
|
|
509
506
|
}
|
|
507
|
+
get routes() {
|
|
508
|
+
return this._routes;
|
|
509
|
+
}
|
|
510
510
|
}
|
|
511
511
|
exports.Apps = Apps;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { Readable } from 'stream';
|
|
4
3
|
import { AppMetaInfo } from '../..';
|
|
5
4
|
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
@@ -21,14 +20,14 @@ export declare class Assets extends InfraClient {
|
|
|
21
20
|
headers: any;
|
|
22
21
|
}>;
|
|
23
22
|
getFilteredDependencies(apps: string | string[], dependencies: AppMetaInfo[]): AppMetaInfo[];
|
|
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<{
|
|
23
|
+
getAppBundleByVendor: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Readable>;
|
|
24
|
+
protected getAppJSONByAccount: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
25
|
+
protected getAppJSONByVendor: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
26
|
+
protected getAppFileByAccount: (app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
28
27
|
data: Buffer;
|
|
29
28
|
headers: any;
|
|
30
29
|
}>;
|
|
31
|
-
protected getAppFileByVendor: (app: string, path: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
30
|
+
protected getAppFileByVendor: (app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
32
31
|
data: Buffer;
|
|
33
32
|
headers: any;
|
|
34
33
|
}>;
|
|
@@ -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] &&
|
|
25
|
+
return buildFeatures && buildFeatures[appVendorName] && 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 =
|
|
38
|
+
const locator = 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 =
|
|
55
|
+
const locator = 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 =
|
|
70
|
+
const locator = 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 =
|
|
86
|
+
const locator = 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 =
|
|
101
|
+
const locator = 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 = !
|
|
132
|
+
const result = !ramda_1.isEmpty(pickArray) ? 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 =
|
|
140
|
+
const result = 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 =
|
|
145
|
+
const locator = 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 =
|
|
153
|
+
const locator = 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
|
|
163
|
+
return 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) => Promise<BillingMetric>;
|
|
6
|
+
sendMetric: (metric: BillingMetric, tracingConfig?: RequestTracingConfig | undefined) => 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) => Promise<void>;
|
|
6
|
+
sendEvent: (appIdOrResource: string | ResourceVRN, route: string, message?: any, tracingConfig?: RequestTracingConfig | undefined) => 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) =>
|
|
8
|
+
const isResourceVRN = (appIdOrResource) => util_1.isObject(appIdOrResource) && !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) => Promise<void>;
|
|
8
|
-
perform: (tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
9
|
-
resolve: (tracingConfig?: RequestTracingConfig) => Promise<HousekeeperStatesAndUpdates>;
|
|
7
|
+
apply: (data: HousekeeperStatesAndUpdates, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
8
|
+
perform: (tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
9
|
+
resolve: (tracingConfig?: RequestTracingConfig | undefined) => Promise<HousekeeperStatesAndUpdates>;
|
|
10
10
|
}
|
|
@@ -1,38 +1,32 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
2
|
import { IncomingMessage } from 'http';
|
|
5
3
|
import { Readable, Writable } from 'stream';
|
|
6
4
|
import { ZlibOptions } from 'zlib';
|
|
7
5
|
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
8
|
-
import { AppFilesList, AppManifest, AppState } from '../../responses';
|
|
6
|
+
import { AppBundlePublished, AppFilesList, AppManifest, AppState } from '../../responses';
|
|
9
7
|
import { IOContext } from '../../service/worker/runtime/typings';
|
|
10
8
|
import { InfraClient } from './InfraClient';
|
|
11
9
|
export declare class Registry extends InfraClient {
|
|
12
10
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
13
|
-
getAppState: (app: string, version: string, tracingConfig?: RequestTracingConfig) => Promise<AppState>;
|
|
14
|
-
publishApp: (files: File[], tag?: string, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig) => Promise<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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<{
|
|
11
|
+
getAppState: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppState>;
|
|
12
|
+
publishApp: (files: File[], tag?: string | undefined, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppBundlePublished>;
|
|
13
|
+
publishAppRc: (files: File[], tag?: string | undefined, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppBundlePublished>;
|
|
14
|
+
listApps: (tracingConfig?: RequestTracingConfig | undefined) => Promise<RegistryAppsList>;
|
|
15
|
+
listVersionsByApp: (app: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<RegistryAppVersionsList>;
|
|
16
|
+
deprecateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
17
|
+
undeprecateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
18
|
+
validateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
19
|
+
getAppManifest: (app: string, version: string, opts?: AppsManifestOptions | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppManifest>;
|
|
20
|
+
listAppFiles: (app: string, version: string, opts?: ListAppFilesOptions | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppFilesList>;
|
|
21
|
+
getAppFile: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
28
22
|
data: Buffer;
|
|
29
23
|
headers: any;
|
|
30
24
|
}>;
|
|
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[]>>;
|
|
25
|
+
getAppJSON: <T extends object | null>(app: string, version: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
26
|
+
getAppFileStream: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<IncomingMessage>;
|
|
27
|
+
getAppBundle: (app: string, version: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Readable>;
|
|
28
|
+
unpackAppBundle: (app: string, version: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Writable>;
|
|
29
|
+
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<Record<string, string[]>>;
|
|
36
30
|
private publish;
|
|
37
31
|
}
|
|
38
32
|
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(
|
|
161
|
-
.pipe(
|
|
160
|
+
.pipe(zlib_1.createGunzip())
|
|
161
|
+
.pipe(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 =
|
|
179
|
+
const zip = 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;
|
|
@@ -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) => 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>;
|
|
6
|
+
listAvailableIoVersions: (tracingConfig?: RequestTracingConfig | undefined) => Promise<AvaiableIO[]>;
|
|
7
|
+
getInstalledIoVersion: (tracingConfig?: RequestTracingConfig | undefined) => Promise<AvaiableIO>;
|
|
8
|
+
installIo: (version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
9
|
+
listAvailableServices: (tracingConfig?: RequestTracingConfig | undefined) => Promise<AvailableServices>;
|
|
10
|
+
getAvailableVersions: (name: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<AvailableServiceVersions>;
|
|
11
|
+
listInstalledServices: (tracingConfig?: RequestTracingConfig | undefined) => Promise<InstalledService[]>;
|
|
12
|
+
installService: (name: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => 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 type InstalledIO = AvaiableIO;
|
|
21
|
+
export declare type InstalledIO = AvaiableIO;
|
|
22
22
|
export interface AvailableServiceVersions {
|
|
23
23
|
versions: {
|
|
24
24
|
[region: string]: string[];
|
|
@@ -3,8 +3,8 @@ import { IOContext } from '../../service/worker/runtime/typings';
|
|
|
3
3
|
import { InfraClient } from './InfraClient';
|
|
4
4
|
export declare class Sphinx extends InfraClient {
|
|
5
5
|
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
6
|
-
validatePolicies: (policies: PolicyRequest[], tracingConfig?: RequestTracingConfig) => Promise<void>;
|
|
7
|
-
isAdmin: (email: string, tracingConfig?: RequestTracingConfig) => Promise<boolean>;
|
|
6
|
+
validatePolicies: (policies: PolicyRequest[], tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
7
|
+
isAdmin: (email: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<boolean>;
|
|
8
8
|
}
|
|
9
9
|
export interface PolicyRequest {
|
|
10
10
|
name: string;
|