@webiny/api 6.1.0-beta.3 → 6.2.0-beta.0

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/Context.d.ts CHANGED
@@ -2,7 +2,6 @@ import type { Context as ContextInterface } from "./types.js";
2
2
  import { PluginsContainer } from "@webiny/plugins";
3
3
  import type { PluginCollection } from "@webiny/plugins/types.js";
4
4
  import { Benchmark } from "./Benchmark.js";
5
- import type { ICompressor } from "@webiny/utils/compression/Compressor.js";
6
5
  import { Container } from "@webiny/di";
7
6
  export interface ContextParams {
8
7
  plugins?: PluginCollection | PluginsContainer;
@@ -14,7 +13,6 @@ export declare class Context implements ContextInterface {
14
13
  readonly plugins: PluginsContainer;
15
14
  readonly WEBINY_VERSION: string;
16
15
  readonly benchmark: Benchmark;
17
- readonly compressor: ICompressor;
18
16
  readonly container: Container;
19
17
  private readonly waiters;
20
18
  constructor(params: ContextParams);
package/Context.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { PluginsContainer } from "@webiny/plugins";
2
2
  import { Benchmark } from "./Benchmark.js";
3
3
  import { BenchmarkPlugin } from "./plugins/BenchmarkPlugin.js";
4
- import { createDefaultCompressor } from "@webiny/utils/compression/index.js";
5
- import { CompressorPlugin } from "./plugins/CompressorPlugin.js";
6
4
  import { Container } from "@webiny/di";
5
+ import { CompressionFeature } from "@webiny/utils/features/compression/feature.js";
7
6
  const getPluginsContainer = plugins => {
8
7
  if (!plugins) {
9
8
  return new PluginsContainer();
@@ -23,19 +22,16 @@ export class Context {
23
22
  this.plugins = getPluginsContainer(plugins);
24
23
  this.WEBINY_VERSION = WEBINY_VERSION;
25
24
  this.container = new Container();
25
+ /**
26
+ * Register base features.
27
+ */
28
+ CompressionFeature.register(this.container);
26
29
  /**
27
30
  * At the moment, let's have benchmark as part of the context.
28
31
  * Also, register the plugin to have benchmark accessible via plugins container.
29
32
  */
30
33
  this.benchmark = new Benchmark();
31
- this.compressor = createDefaultCompressor({
32
- plugins: this.plugins
33
- });
34
- this.plugins.register(new BenchmarkPlugin(this.benchmark), new CompressorPlugin({
35
- getCompressor: () => {
36
- return this.compressor;
37
- }
38
- }));
34
+ this.plugins.register(new BenchmarkPlugin(this.benchmark));
39
35
  }
40
36
  getResult() {
41
37
  return this._result;
package/Context.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["PluginsContainer","Benchmark","BenchmarkPlugin","createDefaultCompressor","CompressorPlugin","Container","getPluginsContainer","plugins","Context","waiters","constructor","params","WEBINY_VERSION","container","benchmark","compressor","register","getCompressor","getResult","_result","hasResult","setResult","value","waitFor","obj","cb","initialTargets","Array","isArray","targets","key","target","Object","defineProperty","set","newTargetKey","waiter","includes","filter","t","length","get","configurable","push"],"sources":["Context.ts"],"sourcesContent":["import type { Context as ContextInterface } from \"~/types.js\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport type { PluginCollection } from \"@webiny/plugins/types.js\";\nimport { Benchmark } from \"~/Benchmark.js\";\nimport { BenchmarkPlugin } from \"~/plugins/BenchmarkPlugin.js\";\nimport type { ICompressor } from \"@webiny/utils/compression/Compressor.js\";\nimport { createDefaultCompressor } from \"@webiny/utils/compression/index.js\";\nimport { CompressorPlugin } from \"~/plugins/CompressorPlugin.js\";\nimport { Container } from \"@webiny/di\";\n\ninterface Waiter {\n targets: string[];\n cb: (context: ContextInterface) => void;\n}\n\nexport interface ContextParams {\n plugins?: PluginCollection | PluginsContainer;\n WEBINY_VERSION: string;\n}\n\nconst getPluginsContainer = (plugins?: PluginCollection | PluginsContainer): PluginsContainer => {\n if (!plugins) {\n return new PluginsContainer();\n }\n if (plugins instanceof PluginsContainer) {\n return plugins;\n }\n return new PluginsContainer(plugins);\n};\n\nexport class Context implements ContextInterface {\n public _result: any;\n public args: any;\n public readonly plugins: PluginsContainer;\n public readonly WEBINY_VERSION: string;\n public readonly benchmark: Benchmark;\n public readonly compressor: ICompressor;\n public readonly container: Container;\n\n private readonly waiters: Waiter[] = [];\n\n public constructor(params: ContextParams) {\n const { plugins, WEBINY_VERSION } = params;\n this.plugins = getPluginsContainer(plugins);\n this.WEBINY_VERSION = WEBINY_VERSION;\n this.container = new Container();\n /**\n * At the moment, let's have benchmark as part of the context.\n * Also, register the plugin to have benchmark accessible via plugins container.\n */\n this.benchmark = new Benchmark();\n this.compressor = createDefaultCompressor({\n plugins: this.plugins\n });\n this.plugins.register(\n new BenchmarkPlugin(this.benchmark),\n new CompressorPlugin({\n getCompressor: () => {\n return this.compressor;\n }\n })\n );\n }\n\n public getResult(): any {\n return this._result;\n }\n\n public hasResult(): boolean {\n return !!this._result;\n }\n\n public setResult(value: any): void {\n this._result = value;\n }\n\n public waitFor<T extends ContextInterface = ContextInterface>(\n obj: string | string[],\n cb: (context: T) => void\n ): void {\n const initialTargets = Array.isArray(obj) ? obj : [obj];\n const targets: string[] = [];\n /**\n * We go only through the first level properties\n */\n for (const key in initialTargets) {\n const target = initialTargets[key] as keyof this;\n /**\n * If property already exists, there is no need to wait for it, so we just continue the loop.\n * Also, if target is not a string, skip this property as it will fail to convert properly during the runtime.\n */\n if (this[target]) {\n continue;\n } else if (typeof target !== \"string\") {\n continue;\n }\n /**\n * Since there is no property, we must define it with its setter and getter.\n * We could not know when it got defined otherwise.\n */\n Object.defineProperty(this, target, {\n /**\n * Setter sets the given value to this object.\n * We cannot set it on exact property name it is defined because it would go into loop of setting itself.\n * And that is why we add __ around the property name.\n */\n set: (value: any) => {\n const newTargetKey = `__${target}__` as keyof this;\n this[newTargetKey] = value;\n /**\n * WWhen the property is set, we will go through all the waiters and, if any of them include currently set property, act on it.\n */\n for (const waiter of this.waiters) {\n if (waiter.targets.includes(target) === false) {\n continue;\n }\n /**\n * Remove currently set property so we know if there are any more to be waited for.\n */\n waiter.targets = waiter.targets.filter(t => t !== target);\n /**\n * If there are more to be waited, eg. user added [cms, pageBuilder] as waited properties, we just continue the loop.\n */\n if (waiter.targets.length > 0) {\n continue;\n }\n /**\n * And if there is nothing more to be waited for, we execute the callable.\n * Note that this callable is not async.\n */\n waiter.cb(this);\n }\n },\n /**\n * As we have set property with __ around it, we must get it as well.\n */\n get: (): any => {\n const newTargetKey = `__${target}__` as keyof this;\n return this[newTargetKey];\n },\n configurable: false\n });\n /**\n * We add the target to be awaited.\n */\n targets.push(target as string);\n }\n /**\n * If there are no targets to be awaited, just fire the callable.\n */\n if (targets.length === 0) {\n cb(this as unknown as T);\n return;\n }\n /**\n * Otherwise add the waiter for the target properties.\n */\n this.waiters.push({\n targets,\n /**\n * TODO @ts-refactor\n * Problem with possible subtype initialization\n */\n // @ts-expect-error\n cb\n });\n }\n}\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,iBAAiB;AAElD,SAASC,SAAS;AAClB,SAASC,eAAe;AAExB,SAASC,uBAAuB,QAAQ,oCAAoC;AAC5E,SAASC,gBAAgB;AACzB,SAASC,SAAS,QAAQ,YAAY;AAYtC,MAAMC,mBAAmB,GAAIC,OAA6C,IAAuB;EAC7F,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,IAAIP,gBAAgB,CAAC,CAAC;EACjC;EACA,IAAIO,OAAO,YAAYP,gBAAgB,EAAE;IACrC,OAAOO,OAAO;EAClB;EACA,OAAO,IAAIP,gBAAgB,CAACO,OAAO,CAAC;AACxC,CAAC;AAED,OAAO,MAAMC,OAAO,CAA6B;EAS5BC,OAAO,GAAa,EAAE;EAEhCC,WAAWA,CAACC,MAAqB,EAAE;IACtC,MAAM;MAAEJ,OAAO;MAAEK;IAAe,CAAC,GAAGD,MAAM;IAC1C,IAAI,CAACJ,OAAO,GAAGD,mBAAmB,CAACC,OAAO,CAAC;IAC3C,IAAI,CAACK,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,SAAS,GAAG,IAAIR,SAAS,CAAC,CAAC;IAChC;AACR;AACA;AACA;IACQ,IAAI,CAACS,SAAS,GAAG,IAAIb,SAAS,CAAC,CAAC;IAChC,IAAI,CAACc,UAAU,GAAGZ,uBAAuB,CAAC;MACtCI,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CAACQ,QAAQ,CAACN,MAAM,CAAC,KAAK,KAAK,EAAE;cAC3C;YACJ;YACA;AACxB;AACA;YACwBK,MAAM,CAACP,OAAO,GAAGO,MAAM,CAACP,OAAO,CAACS,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKR,MAAM,CAAC;YACzD;AACxB;AACA;YACwB,IAAIK,MAAM,CAACP,OAAO,CAACW,MAAM,GAAG,CAAC,EAAE;cAC3B;YACJ;YACA;AACxB;AACA;AACA;YACwBJ,MAAM,CAACX,EAAE,CAAC,IAAI,CAAC;UACnB;QACJ,CAAC;QACD;AAChB;AACA;QACgBgB,GAAG,EAAEA,CAAA,KAAW;UACZ,MAAMN,YAAY,GAAG,KAAKJ,MAAM,IAAkB;UAClD,OAAO,IAAI,CAACI,YAAY,CAAC;QAC7B,CAAC;QACDO,YAAY,EAAE;MAClB,CAAC,CAAC;MACF;AACZ;AACA;MACYb,OAAO,CAACc,IAAI,CAACZ,MAAgB,CAAC;IAClC;IACA;AACR;AACA;IACQ,IAAIF,OAAO,CAACW,MAAM,KAAK,CAAC,EAAE;MACtBf,EAAE,CAAC,IAAoB,CAAC;MACxB;IACJ;IACA;AACR;AACA;IACQ,IAAI,CAAChB,OAAO,CAACkC,IAAI,CAAC;MACdd,OAAO;MACP;AACZ;AACA;AACA;MACY;MACAJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["PluginsContainer","Benchmark","BenchmarkPlugin","Container","CompressionFeature","getPluginsContainer","plugins","Context","waiters","constructor","params","WEBINY_VERSION","container","register","benchmark","getResult","_result","hasResult","setResult","value","waitFor","obj","cb","initialTargets","Array","isArray","targets","key","target","Object","defineProperty","set","newTargetKey","waiter","includes","filter","t","length","get","configurable","push"],"sources":["Context.ts"],"sourcesContent":["import type { Context as ContextInterface } from \"~/types.js\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport type { PluginCollection } from \"@webiny/plugins/types.js\";\nimport { Benchmark } from \"~/Benchmark.js\";\nimport { BenchmarkPlugin } from \"~/plugins/BenchmarkPlugin.js\";\nimport { Container } from \"@webiny/di\";\nimport { CompressionFeature } from \"@webiny/utils/features/compression/feature.js\";\n\ninterface Waiter {\n targets: string[];\n cb: (context: ContextInterface) => void;\n}\n\nexport interface ContextParams {\n plugins?: PluginCollection | PluginsContainer;\n WEBINY_VERSION: string;\n}\n\nconst getPluginsContainer = (plugins?: PluginCollection | PluginsContainer): PluginsContainer => {\n if (!plugins) {\n return new PluginsContainer();\n }\n if (plugins instanceof PluginsContainer) {\n return plugins;\n }\n return new PluginsContainer(plugins);\n};\n\nexport class Context implements ContextInterface {\n public _result: any;\n public args: any;\n public readonly plugins: PluginsContainer;\n public readonly WEBINY_VERSION: string;\n public readonly benchmark: Benchmark;\n public readonly container: Container;\n\n private readonly waiters: Waiter[] = [];\n\n public constructor(params: ContextParams) {\n const { plugins, WEBINY_VERSION } = params;\n this.plugins = getPluginsContainer(plugins);\n this.WEBINY_VERSION = WEBINY_VERSION;\n this.container = new Container();\n /**\n * Register base features.\n */\n CompressionFeature.register(this.container);\n /**\n * At the moment, let's have benchmark as part of the context.\n * Also, register the plugin to have benchmark accessible via plugins container.\n */\n this.benchmark = new Benchmark();\n this.plugins.register(new BenchmarkPlugin(this.benchmark));\n }\n\n public getResult(): any {\n return this._result;\n }\n\n public hasResult(): boolean {\n return !!this._result;\n }\n\n public setResult(value: any): void {\n this._result = value;\n }\n\n public waitFor<T extends ContextInterface = ContextInterface>(\n obj: string | string[],\n cb: (context: T) => void\n ): void {\n const initialTargets = Array.isArray(obj) ? obj : [obj];\n const targets: string[] = [];\n /**\n * We go only through the first level properties\n */\n for (const key in initialTargets) {\n const target = initialTargets[key] as keyof this;\n /**\n * If property already exists, there is no need to wait for it, so we just continue the loop.\n * Also, if target is not a string, skip this property as it will fail to convert properly during the runtime.\n */\n if (this[target]) {\n continue;\n } else if (typeof target !== \"string\") {\n continue;\n }\n /**\n * Since there is no property, we must define it with its setter and getter.\n * We could not know when it got defined otherwise.\n */\n Object.defineProperty(this, target, {\n /**\n * Setter sets the given value to this object.\n * We cannot set it on exact property name it is defined because it would go into loop of setting itself.\n * And that is why we add __ around the property name.\n */\n set: (value: any) => {\n const newTargetKey = `__${target}__` as keyof this;\n this[newTargetKey] = value;\n /**\n * WWhen the property is set, we will go through all the waiters and, if any of them include currently set property, act on it.\n */\n for (const waiter of this.waiters) {\n if (waiter.targets.includes(target) === false) {\n continue;\n }\n /**\n * Remove currently set property so we know if there are any more to be waited for.\n */\n waiter.targets = waiter.targets.filter(t => t !== target);\n /**\n * If there are more to be waited, eg. user added [cms, pageBuilder] as waited properties, we just continue the loop.\n */\n if (waiter.targets.length > 0) {\n continue;\n }\n /**\n * And if there is nothing more to be waited for, we execute the callable.\n * Note that this callable is not async.\n */\n waiter.cb(this);\n }\n },\n /**\n * As we have set property with __ around it, we must get it as well.\n */\n get: (): any => {\n const newTargetKey = `__${target}__` as keyof this;\n return this[newTargetKey];\n },\n configurable: false\n });\n /**\n * We add the target to be awaited.\n */\n targets.push(target as string);\n }\n /**\n * If there are no targets to be awaited, just fire the callable.\n */\n if (targets.length === 0) {\n cb(this as unknown as T);\n return;\n }\n /**\n * Otherwise add the waiter for the target properties.\n */\n this.waiters.push({\n targets,\n /**\n * TODO @ts-refactor\n * Problem with possible subtype initialization\n */\n // @ts-expect-error\n cb\n });\n }\n}\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,iBAAiB;AAElD,SAASC,SAAS;AAClB,SAASC,eAAe;AACxB,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,kBAAkB,QAAQ,+CAA+C;AAYlF,MAAMC,mBAAmB,GAAIC,OAA6C,IAAuB;EAC7F,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,IAAIN,gBAAgB,CAAC,CAAC;EACjC;EACA,IAAIM,OAAO,YAAYN,gBAAgB,EAAE;IACrC,OAAOM,OAAO;EAClB;EACA,OAAO,IAAIN,gBAAgB,CAACM,OAAO,CAAC;A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;MACYC,MAAM,CAACC,cAAc,CAAC,IAAI,EAAEF,MAAM,EAAE;QAChC;AAChB;AACA;AACA;AACA;QACgBG,GAAG,EAAGZ,KAAU,IAAK;UACjB,MAAMa,YAAY,GAAG,KAAKJ,MAAM,IAAkB;UAClD,IAAI,CAACI,YAAY,CAAC,GAAGb,KAAK;UAC1B;AACpB;AACA;UACoB,KAAK,MAAMc,MAAM,IAAI,IAAI,CAACzB,OAAO,EAAE;YAC/B,IAAIyB,MAAM,CAACP,OAAO,CAACQ,QAAQ,CAACN,MAAM,CAAC,KAAK,KAAK,EAAE;cAC3C;YACJ;YACA;AACxB;AACA;YACwBK,MAAM,CAACP,OAAO,GAAGO,MAAM,CAACP,OAAO,CAACS,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKR,MAAM,CAAC;YACzD;AACxB;AACA;YACwB,IAAIK,MAAM,CAACP,OAAO,CAACW,MAAM,GAAG,CAAC,EAAE;cAC3B;YACJ;YACA;AACxB;AACA;AACA;YACwBJ,MAAM,CAACX,EAAE,CAAC,IAAI,CAAC;UACnB;QACJ,CAAC;QACD;AAChB;AACA;QACgBgB,GAAG,EAAEA,CAAA,KAAW;UACZ,MAAMN,YAAY,GAAG,KAAKJ,MAAM,IAAkB;UAClD,OAAO,IAAI,CAACI,YAAY,CAAC;QAC7B,CAAC;QACDO,YAAY,EAAE;MAClB,CAAC,CAAC;MACF;AACZ;AACA;MACYb,OAAO,CAACc,IAAI,CAACZ,MAAgB,CAAC;IAClC;IACA;AACR;AACA;IACQ,IAAIF,OAAO,CAACW,MAAM,KAAK,CAAC,EAAE;MACtBf,EAAE,CAAC,IAAoB,CAAC;MACxB;IACJ;IACA;AACR;AACA;IACQ,IAAI,CAACd,OAAO,CAACgC,IAAI,CAAC;MACdd,OAAO;MACP;AACZ;AACA;AACA;MACY;MACAJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./Context.js";
2
- export * from "./plugins/CompressorPlugin.js";
3
2
  export * from "./decorateContext.js";
4
3
  export * from "./createConditionalPluginFactory.js";
5
4
  export * from "./ServiceDiscovery.js";
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./Context.js";
2
- export * from "./plugins/CompressorPlugin.js";
3
2
  export * from "./decorateContext.js";
4
3
  export * from "./createConditionalPluginFactory.js";
5
4
  export * from "./ServiceDiscovery.js";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Context.js\";\nexport * from \"./plugins/CompressorPlugin.js\";\nexport * from \"./decorateContext.js\";\nexport * from \"./createConditionalPluginFactory.js\";\nexport * from \"./ServiceDiscovery.js\";\nexport * from \"./plugins/ContextPlugin.js\";\nexport * from \"./helpers/InterfaceGenerator/index.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Context.js\";\nexport * from \"./decorateContext.js\";\nexport * from \"./createConditionalPluginFactory.js\";\nexport * from \"./ServiceDiscovery.js\";\nexport * from \"./plugins/ContextPlugin.js\";\nexport * from \"./helpers/InterfaceGenerator/index.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api",
3
- "version": "6.1.0-beta.3",
3
+ "version": "6.2.0-beta.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -13,21 +13,21 @@
13
13
  ],
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@webiny/aws-sdk": "6.1.0-beta.3",
16
+ "@webiny/aws-sdk": "6.2.0-beta.0",
17
17
  "@webiny/di": "0.2.3",
18
- "@webiny/plugins": "6.1.0-beta.3",
19
- "@webiny/utils": "6.1.0-beta.3"
18
+ "@webiny/plugins": "6.2.0-beta.0",
19
+ "@webiny/utils": "6.2.0-beta.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@webiny/build-tools": "6.1.0-beta.3",
23
- "@webiny/project-utils": "6.1.0-beta.3",
22
+ "@webiny/build-tools": "6.2.0-beta.0",
23
+ "@webiny/project-utils": "6.2.0-beta.0",
24
24
  "rimraf": "6.1.3",
25
25
  "typescript": "5.9.3",
26
- "vitest": "4.1.2"
26
+ "vitest": "4.1.4"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public",
30
30
  "directory": "dist"
31
31
  },
32
- "gitHead": "65e0ac1889b3392c99b8cac6cde508e1e831c715"
32
+ "gitHead": "3d3148358b6febbc857371930871743bec3b3939"
33
33
  }
package/types.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { Container } from "@webiny/di";
2
2
  import type { PluginsContainer } from "@webiny/plugins";
3
- import type { ICompressor } from "@webiny/utils/compression/Compressor.js";
4
3
  export type GenericRecord<K extends PropertyKey = PropertyKey, V = any> = Record<K, V>;
5
4
  export type NonEmptyArray<T> = [T, ...T[]];
6
5
  export type PossiblyUndefinedProperties<T> = {
@@ -77,8 +76,4 @@ export interface Context {
77
76
  * Benchmark instance to help determine possible bugs and slow code.
78
77
  */
79
78
  benchmark: Benchmark;
80
- /**
81
- * Compressor instance to compress and decompress the data.
82
- */
83
- compressor: ICompressor;
84
79
  }
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ICompressor } from \"@webiny/utils/compression/Compressor.js\";\n\nexport type GenericRecord<K extends PropertyKey = PropertyKey, V = any> = Record<K, V>;\n\nexport type NonEmptyArray<T> = [T, ...T[]];\n\nexport type PossiblyUndefinedProperties<T> = {\n [K in keyof T]: T[K] extends undefined ? T[K] : T[K] | undefined;\n};\n\nexport type BenchmarkRuns = GenericRecord<string, number>;\n\nexport interface BenchmarkMeasurement {\n name: string;\n category: string;\n start: Date;\n end: Date;\n elapsed: number;\n memory: number;\n}\n\nexport interface BenchmarkEnableOnCallable {\n (): Promise<boolean>;\n}\n\nexport interface BenchmarkOutputCallableParams {\n benchmark: Benchmark;\n stop: () => \"stop\";\n}\nexport interface BenchmarkOutputCallable {\n (params: BenchmarkOutputCallableParams): Promise<\"stop\" | undefined | null | void>;\n}\nexport interface BenchmarkMeasureOptions {\n name: string;\n category: string;\n}\nexport interface Benchmark {\n elapsed: number;\n runs: BenchmarkRuns;\n measurements: BenchmarkMeasurement[];\n output: () => Promise<void>;\n onOutput: (cb: BenchmarkOutputCallable) => void;\n enableOn: (cb: BenchmarkEnableOnCallable) => void;\n measure: <T = any>(\n options: BenchmarkMeasureOptions | string,\n cb: () => Promise<T>\n ) => Promise<T>;\n enable: () => void;\n disable: () => void;\n}\n\n/**\n * The main context which is constructed on every request.\n * All other contexts should extend or augment this one.\n */\nexport interface Context {\n plugins: PluginsContainer;\n /**\n * @internal\n */\n container: Container;\n readonly WEBINY_VERSION: string;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n */\n hasResult: () => boolean;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n *\n * @private\n */\n _result?: unknown;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n */\n setResult: (value: unknown) => void;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n */\n getResult: () => void;\n /**\n * Benchmark instance to help determine possible bugs and slow code.\n */\n benchmark: Benchmark;\n /**\n * Compressor instance to compress and decompress the data.\n */\n compressor: ICompressor;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\nexport type GenericRecord<K extends PropertyKey = PropertyKey, V = any> = Record<K, V>;\n\nexport type NonEmptyArray<T> = [T, ...T[]];\n\nexport type PossiblyUndefinedProperties<T> = {\n [K in keyof T]: T[K] extends undefined ? T[K] : T[K] | undefined;\n};\n\nexport type BenchmarkRuns = GenericRecord<string, number>;\n\nexport interface BenchmarkMeasurement {\n name: string;\n category: string;\n start: Date;\n end: Date;\n elapsed: number;\n memory: number;\n}\n\nexport interface BenchmarkEnableOnCallable {\n (): Promise<boolean>;\n}\n\nexport interface BenchmarkOutputCallableParams {\n benchmark: Benchmark;\n stop: () => \"stop\";\n}\nexport interface BenchmarkOutputCallable {\n (params: BenchmarkOutputCallableParams): Promise<\"stop\" | undefined | null | void>;\n}\nexport interface BenchmarkMeasureOptions {\n name: string;\n category: string;\n}\nexport interface Benchmark {\n elapsed: number;\n runs: BenchmarkRuns;\n measurements: BenchmarkMeasurement[];\n output: () => Promise<void>;\n onOutput: (cb: BenchmarkOutputCallable) => void;\n enableOn: (cb: BenchmarkEnableOnCallable) => void;\n measure: <T = any>(\n options: BenchmarkMeasureOptions | string,\n cb: () => Promise<T>\n ) => Promise<T>;\n enable: () => void;\n disable: () => void;\n}\n\n/**\n * The main context which is constructed on every request.\n * All other contexts should extend or augment this one.\n */\nexport interface Context {\n plugins: PluginsContainer;\n /**\n * @internal\n */\n container: Container;\n readonly WEBINY_VERSION: string;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n */\n hasResult: () => boolean;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n *\n * @private\n */\n _result?: unknown;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n */\n setResult: (value: unknown) => void;\n /**\n * Not to be used outside of Webiny internal code.\n * @internal\n */\n getResult: () => void;\n /**\n * Benchmark instance to help determine possible bugs and slow code.\n */\n benchmark: Benchmark;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,14 +0,0 @@
1
- import { Plugin } from "@webiny/plugins/Plugin.js";
2
- import type { ICompressor } from "@webiny/utils/compression/Compressor.js";
3
- export interface ICompressorPluginParams {
4
- getCompressor(): ICompressor;
5
- }
6
- /**
7
- * Should never be initialized outside the api package.
8
- */
9
- export declare class CompressorPlugin extends Plugin {
10
- readonly name: string;
11
- static type: string;
12
- readonly getCompressor: () => ICompressor;
13
- constructor(params: ICompressorPluginParams);
14
- }
@@ -1,14 +0,0 @@
1
- import { Plugin } from "@webiny/plugins/Plugin.js";
2
- /**
3
- * Should never be initialized outside the api package.
4
- */
5
- export class CompressorPlugin extends Plugin {
6
- name = "context.compressor";
7
- static type = "context.compressor";
8
- constructor(params) {
9
- super();
10
- this.getCompressor = params.getCompressor;
11
- }
12
- }
13
-
14
- //# sourceMappingURL=CompressorPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Plugin","CompressorPlugin","name","type","constructor","params","getCompressor"],"sources":["CompressorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { ICompressor } from \"@webiny/utils/compression/Compressor.js\";\n\nexport interface ICompressorPluginParams {\n getCompressor(): ICompressor;\n}\n\n/**\n * Should never be initialized outside the api package.\n */\nexport class CompressorPlugin extends Plugin {\n public override readonly name: string = \"context.compressor\";\n public static override type: string = \"context.compressor\";\n\n public readonly getCompressor: () => ICompressor;\n\n public constructor(params: ICompressorPluginParams) {\n super();\n this.getCompressor = params.getCompressor;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,2BAA2B;AAOlD;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASD,MAAM,CAAC;EAChBE,IAAI,GAAW,oBAAoB;EAC5D,OAAuBC,IAAI,GAAW,oBAAoB;EAInDC,WAAWA,CAACC,MAA+B,EAAE;IAChD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,aAAa,GAAGD,MAAM,CAACC,aAAa;EAC7C;AACJ","ignoreList":[]}