@vtex/api 1.9.2 → 1.9.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/lib/Apps.d.ts +0 -66
  4. package/lib/Apps.js +0 -211
  5. package/lib/Billing.d.ts +0 -18
  6. package/lib/Billing.js +0 -27
  7. package/lib/Builder.d.ts +0 -40
  8. package/lib/Builder.js +0 -80
  9. package/lib/Events.d.ts +0 -6
  10. package/lib/Events.js +0 -19
  11. package/lib/HttpClient/context.d.ts +0 -9
  12. package/lib/HttpClient/context.js +0 -2
  13. package/lib/HttpClient/index.d.ts +0 -92
  14. package/lib/HttpClient/index.js +0 -121
  15. package/lib/HttpClient/middlewares/cache.d.ts +0 -16
  16. package/lib/HttpClient/middlewares/cache.js +0 -85
  17. package/lib/HttpClient/middlewares/metrics.d.ts +0 -3
  18. package/lib/HttpClient/middlewares/metrics.js +0 -41
  19. package/lib/HttpClient/middlewares/notFound.d.ts +0 -7
  20. package/lib/HttpClient/middlewares/notFound.js +0 -28
  21. package/lib/HttpClient/middlewares/recorder.d.ts +0 -3
  22. package/lib/HttpClient/middlewares/recorder.js +0 -26
  23. package/lib/HttpClient/middlewares/request.d.ts +0 -3
  24. package/lib/HttpClient/middlewares/request.js +0 -39
  25. package/lib/ID.d.ts +0 -23
  26. package/lib/ID.js +0 -46
  27. package/lib/IODataSource.d.ts +0 -23
  28. package/lib/IODataSource.js +0 -43
  29. package/lib/Logger.d.ts +0 -20
  30. package/lib/Logger.js +0 -62
  31. package/lib/Metadata.d.ts +0 -27
  32. package/lib/Metadata.js +0 -53
  33. package/lib/Registry.d.ts +0 -52
  34. package/lib/Registry.js +0 -112
  35. package/lib/Router.d.ts +0 -35
  36. package/lib/Router.js +0 -52
  37. package/lib/VBase.d.ts +0 -40
  38. package/lib/VBase.js +0 -82
  39. package/lib/Workspaces.d.ts +0 -17
  40. package/lib/Workspaces.js +0 -39
  41. package/lib/caches/CacheLayer.d.ts +0 -7
  42. package/lib/caches/CacheLayer.js +0 -2
  43. package/lib/caches/DiskCache.d.ts +0 -17
  44. package/lib/caches/DiskCache.js +0 -75
  45. package/lib/caches/LRUCache.d.ts +0 -16
  46. package/lib/caches/LRUCache.js +0 -49
  47. package/lib/caches/LRUDiskCache.d.ts +0 -21
  48. package/lib/caches/LRUDiskCache.js +0 -132
  49. package/lib/caches/MultilayeredCache.d.ts +0 -14
  50. package/lib/caches/MultilayeredCache.js +0 -76
  51. package/lib/caches/index.d.ts +0 -6
  52. package/lib/caches/index.js +0 -9
  53. package/lib/caches/typings.d.ts +0 -48
  54. package/lib/caches/typings.js +0 -2
  55. package/lib/constants.d.ts +0 -1
  56. package/lib/constants.js +0 -3
  57. package/lib/index.d.ts +0 -19
  58. package/lib/index.js +0 -21
  59. package/lib/metrics/metricsAccumulator.d.ts +0 -27
  60. package/lib/metrics/metricsAccumulator.js +0 -80
  61. package/lib/metrics/metricsLogger.d.ts +0 -6
  62. package/lib/metrics/metricsLogger.js +0 -2
  63. package/lib/responses.d.ts +0 -95
  64. package/lib/responses.js +0 -2
  65. package/lib/runtime.d.ts +0 -27
  66. package/lib/runtime.js +0 -2
  67. package/lib/utils/AppId.d.ts +0 -19
  68. package/lib/utils/AppId.js +0 -42
  69. package/lib/utils/Time.d.ts +0 -4
  70. package/lib/utils/Time.js +0 -7
  71. package/lib/utils/index.d.ts +0 -2
  72. package/lib/utils/index.js +0 -7
  73. package/lib/utils/json.d.ts +0 -5
  74. package/lib/utils/json.js +0 -18
  75. package/lib/utils/log.d.ts +0 -3
  76. package/lib/utils/log.js +0 -7
@@ -1,21 +0,0 @@
1
- import { CacheLayer } from './CacheLayer';
2
- import { LRUDiskCacheOptions, LRUStats } from './typings';
3
- import { outputJSON, readJSON } from 'fs-extra';
4
- export declare class LRUDiskCache<V> implements CacheLayer<string, V> {
5
- private cachePath;
6
- private readFile;
7
- private writeFile;
8
- private lock;
9
- private disposed;
10
- private hits;
11
- private total;
12
- private lruStorage;
13
- private keyToBeDeleted;
14
- constructor(cachePath: string, options: LRUDiskCacheOptions, readFile?: typeof readJSON, writeFile?: typeof outputJSON);
15
- has: (key: string) => boolean;
16
- getStats: (name?: string) => LRUStats;
17
- get: (key: string) => Promise<void | V>;
18
- set: (key: string, value: V, maxAge?: number | undefined) => Promise<boolean>;
19
- private getPathKey;
20
- private deleteFile;
21
- }
@@ -1,132 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const fs_extra_1 = require("fs-extra");
12
- const LRU = require("lru-cache");
13
- const path_1 = require("path");
14
- const ReadWriteLock = require("rwlock");
15
- class LRUDiskCache {
16
- constructor(cachePath, options, readFile = fs_extra_1.readJSON, writeFile = fs_extra_1.outputJSON) {
17
- this.cachePath = cachePath;
18
- this.readFile = readFile;
19
- this.writeFile = writeFile;
20
- this.hits = 0;
21
- this.total = 0;
22
- this.has = (key) => this.lruStorage.has(key);
23
- this.getStats = (name = 'disk-lru-cache') => {
24
- const stats = {
25
- disposedItems: this.disposed,
26
- hitRate: this.total > 0 ? this.hits / this.total : undefined,
27
- hits: this.hits,
28
- itemCount: this.lruStorage.itemCount,
29
- length: this.lruStorage.length,
30
- max: this.lruStorage.max,
31
- name,
32
- total: this.total,
33
- };
34
- this.hits = 0;
35
- this.total = 0;
36
- this.disposed = 0;
37
- return stats;
38
- };
39
- this.get = (key) => __awaiter(this, void 0, void 0, function* () {
40
- const timeOfDeath = this.lruStorage.get(key);
41
- this.total += 1;
42
- if (timeOfDeath === undefined) {
43
- // if it is an outdated file when stale=false
44
- if (this.keyToBeDeleted) {
45
- yield this.deleteFile(key);
46
- }
47
- return undefined;
48
- }
49
- const pathKey = this.getPathKey(key);
50
- const data = yield new Promise(resolve => {
51
- this.lock.readLock(key, (release) => __awaiter(this, void 0, void 0, function* () {
52
- try {
53
- const fileData = yield this.readFile(pathKey);
54
- release();
55
- this.hits += 1;
56
- resolve(fileData);
57
- }
58
- catch (e) {
59
- release();
60
- resolve(undefined);
61
- }
62
- }));
63
- });
64
- // if it is an outdated file when stale=true
65
- if (timeOfDeath < Date.now()) {
66
- this.lruStorage.del(key);
67
- yield this.deleteFile(key);
68
- }
69
- return data;
70
- });
71
- this.set = (key, value, maxAge) => __awaiter(this, void 0, void 0, function* () {
72
- let timeOfDeath = NaN;
73
- if (maxAge) {
74
- timeOfDeath = maxAge + Date.now();
75
- this.lruStorage.set(key, timeOfDeath, maxAge);
76
- }
77
- else {
78
- this.lruStorage.set(key, NaN);
79
- }
80
- if (this.keyToBeDeleted && this.keyToBeDeleted !== key) {
81
- yield this.deleteFile(this.keyToBeDeleted);
82
- }
83
- const pathKey = this.getPathKey(key);
84
- const failure = yield new Promise(resolve => {
85
- this.lock.writeLock(key, (release) => __awaiter(this, void 0, void 0, function* () {
86
- try {
87
- const writePromise = yield this.writeFile(pathKey, value);
88
- release();
89
- resolve(writePromise);
90
- }
91
- catch (e) {
92
- release();
93
- resolve(true);
94
- }
95
- }));
96
- });
97
- return !failure;
98
- });
99
- this.getPathKey = (key) => {
100
- return path_1.join(this.cachePath, key);
101
- };
102
- this.deleteFile = (key) => __awaiter(this, void 0, void 0, function* () {
103
- const pathKey = this.getPathKey(key);
104
- this.keyToBeDeleted = '';
105
- const failure = new Promise(resolve => {
106
- this.lock.writeLock(key, (release) => __awaiter(this, void 0, void 0, function* () {
107
- try {
108
- const removePromise = yield fs_extra_1.remove(pathKey);
109
- release();
110
- resolve(removePromise);
111
- }
112
- catch (e) {
113
- release();
114
- resolve(true);
115
- }
116
- }));
117
- });
118
- return !failure;
119
- });
120
- this.hits = 0;
121
- this.total = 0;
122
- this.disposed = 0;
123
- this.keyToBeDeleted = '';
124
- this.lock = new ReadWriteLock();
125
- const dispose = (key) => {
126
- this.keyToBeDeleted = key;
127
- this.disposed += 1;
128
- };
129
- this.lruStorage = new LRU(Object.assign({}, options, { dispose }));
130
- }
131
- }
132
- exports.LRUDiskCache = LRUDiskCache;
@@ -1,14 +0,0 @@
1
- import { CacheLayer } from './CacheLayer';
2
- import { FetchResult, MultilayerStats } from './typings';
3
- export declare class MultilayeredCache<K, V> implements CacheLayer<K, V> {
4
- private caches;
5
- private hits;
6
- private total;
7
- constructor(caches: Array<CacheLayer<K, V>>);
8
- get: (key: K, fetcher?: (() => Promise<FetchResult<V>>) | undefined) => Promise<void | V>;
9
- set: (key: K, value: V, maxAge?: number | undefined) => Promise<boolean>;
10
- has: (key: K) => Promise<boolean>;
11
- getStats: (name?: string) => MultilayerStats;
12
- private findIndex;
13
- private resetCounters;
14
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const ramda_1 = require("ramda");
12
- class MultilayeredCache {
13
- constructor(caches) {
14
- this.caches = caches;
15
- this.hits = 0;
16
- this.total = 0;
17
- this.get = (key, fetcher) => __awaiter(this, void 0, void 0, function* () {
18
- let value;
19
- let maxAge;
20
- let successIndex = yield this.findIndex((cache) => __awaiter(this, void 0, void 0, function* () {
21
- const [getValue, hasKey] = yield Promise.all([cache.get(key), cache.has(key)]);
22
- value = getValue;
23
- return hasKey;
24
- }), this.caches);
25
- if (successIndex === -1) {
26
- if (fetcher) {
27
- const fetched = yield fetcher();
28
- value = fetched.value;
29
- maxAge = fetched.maxAge;
30
- }
31
- else {
32
- return undefined;
33
- }
34
- successIndex = Infinity;
35
- }
36
- const failedCaches = ramda_1.slice(0, successIndex, this.caches);
37
- const [firstPromise] = ramda_1.map(cache => cache.set(key, value, maxAge), failedCaches);
38
- yield firstPromise;
39
- return value;
40
- });
41
- this.set = (key, value, maxAge) => __awaiter(this, void 0, void 0, function* () {
42
- const isSet = yield Promise.all(ramda_1.map(cache => cache.set(key, value, maxAge), this.caches));
43
- return ramda_1.any(item => item, isSet);
44
- });
45
- this.has = (key) => __awaiter(this, void 0, void 0, function* () {
46
- const hasList = yield Promise.all(ramda_1.map(cache => cache.has(key), this.caches));
47
- return ramda_1.any(item => item, hasList);
48
- });
49
- this.getStats = (name = 'multilayred-cache') => {
50
- const multilayerStats = {
51
- hitRate: this.total > 0 ? this.hits / this.total : undefined,
52
- hits: this.hits,
53
- name,
54
- total: this.total,
55
- };
56
- this.resetCounters();
57
- return multilayerStats;
58
- };
59
- this.findIndex = (func, array) => __awaiter(this, void 0, void 0, function* () {
60
- this.total += 1;
61
- for (let index = 0; index < array.length; index++) {
62
- const hasKey = yield func(array[index]);
63
- if (hasKey) {
64
- this.hits += 1;
65
- return index;
66
- }
67
- }
68
- return -1;
69
- });
70
- }
71
- resetCounters() {
72
- this.hits = 0;
73
- this.total = 0;
74
- }
75
- }
76
- exports.MultilayeredCache = MultilayeredCache;
@@ -1,6 +0,0 @@
1
- export * from './CacheLayer';
2
- export * from './DiskCache';
3
- export * from './LRUCache';
4
- export * from './LRUDiskCache';
5
- export * from './MultilayeredCache';
6
- export * from './typings';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./DiskCache"));
7
- __export(require("./LRUCache"));
8
- __export(require("./LRUDiskCache"));
9
- __export(require("./MultilayeredCache"));
@@ -1,48 +0,0 @@
1
- export declare type FetchResult<V> = {
2
- value: V;
3
- maxAge?: number;
4
- };
5
- export declare type DiskStats = {
6
- hits: number;
7
- total: number;
8
- name: string;
9
- };
10
- export declare type LRUStats = {
11
- itemCount: number;
12
- length: number;
13
- disposedItems: number;
14
- hitRate: number | undefined;
15
- hits: number;
16
- max: number;
17
- name: string;
18
- total: number;
19
- };
20
- export declare type MultilayerStats = {
21
- hitRate: number | undefined;
22
- hits: number;
23
- total: number;
24
- name: string;
25
- };
26
- export declare type LRUDiskCacheOptions = {
27
- /**
28
- * The maximum size of the cache, checked by applying the length
29
- * function to all values in the cache. Not setting this is kind of silly,
30
- * since that's the whole purpose of this lib, but it defaults to `Infinity`.
31
- */
32
- max?: number;
33
- /**
34
- * Maximum age in ms. Items are not pro-actively pruned out as they age,
35
- * but if you try to get an item that is too old, it'll drop it and return
36
- * undefined instead of giving it to you.
37
- */
38
- maxAge?: number;
39
- /**
40
- * By default, if you set a `maxAge`, it'll only actually pull stale items
41
- * out of the cache when you `get(key)`. (That is, it's not pre-emptively
42
- * doing a `setTimeout` or anything.) If you set `stale:true`, it'll return
43
- * the stale value before deleting it. If you don't set this, then it'll
44
- * return `undefined` when you try to get a stale entry,
45
- * as if it had already been deleted.
46
- */
47
- stale?: boolean;
48
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export declare const DEFAULT_WORKSPACE = "master";
package/lib/constants.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_WORKSPACE = 'master';
package/lib/index.d.ts DELETED
@@ -1,19 +0,0 @@
1
- export * from './Apps';
2
- export * from './Builder';
3
- export * from './HttpClient';
4
- export * from './Registry';
5
- export * from './Router';
6
- export * from './VBase';
7
- export * from './ID';
8
- export * from './Workspaces';
9
- export * from './Logger';
10
- export * from './Events';
11
- export * from './Metadata';
12
- export * from './responses';
13
- export * from './Billing';
14
- export * from './caches';
15
- export * from './metrics/metricsAccumulator';
16
- export * from './metrics/metricsLogger';
17
- export * from './utils';
18
- export * from './IODataSource';
19
- export * from './runtime';
package/lib/index.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./Apps"));
7
- __export(require("./Builder"));
8
- __export(require("./HttpClient"));
9
- __export(require("./Registry"));
10
- __export(require("./Router"));
11
- __export(require("./VBase"));
12
- __export(require("./ID"));
13
- __export(require("./Workspaces"));
14
- __export(require("./Logger"));
15
- __export(require("./Events"));
16
- __export(require("./Metadata"));
17
- __export(require("./Billing"));
18
- __export(require("./caches"));
19
- __export(require("./metrics/metricsAccumulator"));
20
- __export(require("./utils"));
21
- __export(require("./IODataSource"));
@@ -1,27 +0,0 @@
1
- export interface Metric {
2
- name: string;
3
- [key: string]: any;
4
- }
5
- interface GetStats {
6
- getStats(): {
7
- [key: string]: number | boolean | string | undefined;
8
- };
9
- }
10
- export declare class MetricsAccumulator {
11
- private metricsMillis;
12
- private devMetricsMillis;
13
- private cacheMap;
14
- private onFlushMetrics;
15
- private metricToAggregate;
16
- private devMetricToAggregate;
17
- constructor();
18
- batchHrTimeMetricFromEnd: (name: string, end: [number, number], production: boolean) => void;
19
- batchHrTimeMetric: (name: string, start: [number, number], production: boolean) => void;
20
- batchMetric: (name: string, timeMillis: number, production: boolean) => void;
21
- addOnFlushMetric: (metricFn: () => Metric | Metric[]) => void;
22
- trackCache: (name: string, cacheInstance: GetStats) => void;
23
- statusTrack: () => Metric[];
24
- private cacheToMetric;
25
- private flushMetrics;
26
- }
27
- export {};
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ramda_1 = require("ramda");
4
- const stats_lite_1 = require("stats-lite");
5
- const Time_1 = require("../utils/Time");
6
- let lastCpu = process.cpuUsage();
7
- function cpuUsage() {
8
- const diff = process.cpuUsage(lastCpu);
9
- lastCpu = {
10
- system: lastCpu.system + diff.system,
11
- user: lastCpu.user + diff.user,
12
- };
13
- return diff;
14
- }
15
- const createMetricToAggregateReducer = (production) => (value, key, obj) => {
16
- const aggregate = {
17
- name: key,
18
- count: value.length,
19
- max: Math.max(...value),
20
- mean: stats_lite_1.mean(value),
21
- median: stats_lite_1.median(value),
22
- percentile95: stats_lite_1.percentile(value, 0.95),
23
- percentile99: stats_lite_1.percentile(value, 0.99),
24
- production,
25
- };
26
- delete obj[key];
27
- return aggregate;
28
- };
29
- class MetricsAccumulator {
30
- constructor() {
31
- this.metricToAggregate = createMetricToAggregateReducer(true);
32
- this.devMetricToAggregate = createMetricToAggregateReducer(false);
33
- this.batchHrTimeMetricFromEnd = (name, end, production) => {
34
- this.batchMetric(name, Time_1.hrToMillis(end), production);
35
- };
36
- this.batchHrTimeMetric = (name, start, production) => {
37
- this.batchMetric(name, Time_1.hrToMillis(process.hrtime(start)), production);
38
- };
39
- this.batchMetric = (name, timeMillis, production) => {
40
- if (production) {
41
- if (!this.metricsMillis[name]) {
42
- this.metricsMillis[name] = [];
43
- }
44
- this.metricsMillis[name].push(timeMillis);
45
- }
46
- else {
47
- if (!this.devMetricsMillis[name]) {
48
- this.devMetricsMillis[name] = [];
49
- }
50
- this.devMetricsMillis[name].push(timeMillis);
51
- }
52
- };
53
- this.addOnFlushMetric = (metricFn) => {
54
- this.onFlushMetrics.push(metricFn);
55
- };
56
- this.trackCache = (name, cacheInstance) => {
57
- this.cacheMap[name] = cacheInstance;
58
- };
59
- this.statusTrack = () => {
60
- return this.flushMetrics();
61
- };
62
- this.cacheToMetric = (value, key) => (Object.assign({ name: `${key}-cache` }, value.getStats()));
63
- this.flushMetrics = () => {
64
- const aggregateMetrics = ramda_1.values(ramda_1.mapObjIndexed(this.metricToAggregate, this.metricsMillis));
65
- const aggregateDevMetrics = ramda_1.values(ramda_1.mapObjIndexed(this.devMetricToAggregate, this.devMetricsMillis));
66
- const systemMetrics = [
67
- Object.assign({ name: 'cpu' }, cpuUsage()),
68
- Object.assign({ name: 'memory' }, process.memoryUsage()),
69
- ];
70
- const onFlushMetrics = ramda_1.flatten(ramda_1.map(getMetric => getMetric(), this.onFlushMetrics));
71
- const cacheMetrics = ramda_1.values(ramda_1.mapObjIndexed(this.cacheToMetric, this.cacheMap));
72
- return [...systemMetrics, ...aggregateMetrics, ...aggregateDevMetrics, ...onFlushMetrics, ...cacheMetrics];
73
- };
74
- this.metricsMillis = {};
75
- this.devMetricsMillis = {};
76
- this.onFlushMetrics = [];
77
- this.cacheMap = {};
78
- }
79
- }
80
- exports.MetricsAccumulator = MetricsAccumulator;
@@ -1,6 +0,0 @@
1
- export interface Key {
2
- name: string;
3
- }
4
- export interface MetricsLogger {
5
- add: (key: Key, value: any) => void;
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,95 +0,0 @@
1
- export interface Policy {
2
- name: string;
3
- attrs?: {
4
- [name: string]: string;
5
- };
6
- }
7
- export interface AppManifest {
8
- [internal: string]: any;
9
- vendor: string;
10
- name: string;
11
- version: string;
12
- title?: string;
13
- description?: string;
14
- mustUpdateAt?: string;
15
- builders: {
16
- [name: string]: string;
17
- };
18
- categories?: string[];
19
- dependencies?: {
20
- [name: string]: string;
21
- };
22
- peerDependencies?: {
23
- [name: string]: string;
24
- };
25
- settingsSchema?: any;
26
- registries?: string[];
27
- credentialType?: string;
28
- policies?: Policy[];
29
- billingOptions?: BillingOptions;
30
- _resolvedDependencies?: {
31
- [name: string]: string[];
32
- };
33
- }
34
- export interface FileListItem {
35
- path: string;
36
- hash: string;
37
- }
38
- export interface AppFilesList {
39
- data: FileListItem[];
40
- }
41
- export interface BucketMetadata {
42
- state: string;
43
- lastModified: string;
44
- hash: string;
45
- }
46
- interface RootBillingOptions {
47
- termsURL: string;
48
- support: Support;
49
- }
50
- export interface Support {
51
- url: string;
52
- email: string;
53
- }
54
- export declare type BillingOptions = RootBillingOptions & ({
55
- free: boolean;
56
- } | {
57
- policies: BillingPolicy[];
58
- });
59
- export interface BillingPolicy {
60
- currency: string;
61
- billing: BillingChargeElements;
62
- }
63
- export interface BillingChargeElements {
64
- taxClassification: string;
65
- items: CalculationItem[];
66
- }
67
- export declare type CalculationItem = {
68
- itemCurrency: string;
69
- } & ({
70
- fixed: number;
71
- } | {
72
- calculatedByMetricUnit: CalculatedByMetricUnit;
73
- });
74
- export interface CalculatedByMetricUnit {
75
- metricId: string;
76
- metricName: string;
77
- ranges: Range[];
78
- route?: string;
79
- }
80
- export interface Range {
81
- exclusiveFrom: number;
82
- inclusiveTo?: number;
83
- multiplier: number;
84
- }
85
- export interface AppBundleResponse {
86
- message: string;
87
- id: string;
88
- }
89
- export declare type AppBundlePublished = AppBundleResponse & {
90
- bundleSize?: number;
91
- };
92
- export declare type AppBundleLinked = AppBundleResponse & {
93
- bundleSize?: number;
94
- };
95
- export {};
package/lib/responses.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/lib/runtime.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import { DataSource } from 'apollo-datasource';
2
- import { KeyValueCache } from 'apollo-server-caching';
3
- import { IDirectiveResolvers } from 'graphql-tools';
4
- import { ServiceContext } from './HttpClient';
5
- import { Metric } from './metrics/metricsAccumulator';
6
- export declare type StatusTrack = () => Metric[];
7
- export declare type DataSourcesGenerator = () => {
8
- [name: string]: DataSource<ServiceContext>;
9
- };
10
- export interface GraphQLOptions {
11
- resolvers: any;
12
- dataSources?: DataSourcesGenerator;
13
- schemaDirectives?: IDirectiveResolvers<any, ServiceContext>;
14
- cache?: () => KeyValueCache;
15
- }
16
- export declare type Route = (ctx: ServiceContext) => Promise<void>;
17
- export interface Routes {
18
- [route: string]: Route;
19
- }
20
- export interface RuntimeOptions {
21
- events?: any;
22
- statusTrack?: StatusTrack;
23
- routes?: Routes;
24
- graphql?: GraphQLOptions;
25
- dataSources?: DataSourcesGenerator;
26
- cache?: KeyValueCache;
27
- }
package/lib/runtime.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +0,0 @@
1
- export declare const removeBuild: (id: string) => string;
2
- export declare const removeVersionFromAppId: (appId: string) => string;
3
- export declare const extractVersionFromAppId: (appId: string) => string;
4
- export declare const transformToLinkedLocator: (appId: string) => string;
5
- export declare const formatLocator: (name: string, versionAndBuild: string) => string;
6
- export declare const parseAppId: (appId: string) => ParsedLocator;
7
- export declare const formatAppId: ({ locator, build }: ParsedLocator) => string;
8
- export declare const satisfies: (appId: string, version: string) => boolean;
9
- export declare const versionToMajor: (version: string) => string;
10
- export declare const versionToMajorRange: (version: string) => string;
11
- export declare const formatMajorLocator: (name: string, version: string) => string;
12
- export declare const appIdToAppAtMajor: (appId: string) => string;
13
- export declare const isValidAppIdOrLocator: (appId: string) => boolean;
14
- export interface ParsedLocator {
15
- name: string;
16
- version: string;
17
- locator: string;
18
- build?: string;
19
- }