@webiny/api 0.0.0-unstable.9bd236cf5e → 0.0.0-unstable.9f53ea597d

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 (45) hide show
  1. package/Benchmark.d.ts +1 -1
  2. package/Benchmark.js +120 -156
  3. package/Benchmark.js.map +1 -1
  4. package/Context.d.ts +5 -5
  5. package/Context.js +61 -137
  6. package/Context.js.map +1 -1
  7. package/README.md +10 -14
  8. package/createConditionalPluginFactory.d.ts +1 -1
  9. package/createConditionalPluginFactory.js +5 -15
  10. package/createConditionalPluginFactory.js.map +1 -1
  11. package/decorateContext.js +10 -19
  12. package/decorateContext.js.map +1 -1
  13. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  14. package/helpers/InterfaceGenerator/date.js +0 -0
  15. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  16. package/helpers/InterfaceGenerator/id.js +0 -0
  17. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  18. package/helpers/InterfaceGenerator/identity.js +0 -0
  19. package/helpers/InterfaceGenerator/index.d.ts +6 -0
  20. package/helpers/InterfaceGenerator/index.js +0 -0
  21. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  22. package/helpers/InterfaceGenerator/numeric.js +0 -0
  23. package/helpers/InterfaceGenerator/text.d.ts +11 -0
  24. package/helpers/InterfaceGenerator/text.js +0 -0
  25. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  26. package/helpers/InterfaceGenerator/truthful.js +0 -0
  27. package/index.d.ts +5 -6
  28. package/index.js +5 -73
  29. package/package.json +19 -15
  30. package/plugins/BenchmarkPlugin.d.ts +1 -1
  31. package/plugins/BenchmarkPlugin.js +19 -27
  32. package/plugins/BenchmarkPlugin.js.map +1 -1
  33. package/plugins/ContextPlugin.d.ts +1 -1
  34. package/plugins/ContextPlugin.js +17 -26
  35. package/plugins/ContextPlugin.js.map +1 -1
  36. package/types.d.ts +5 -10
  37. package/types.js +0 -7
  38. package/ServiceDiscovery.d.ts +0 -12
  39. package/ServiceDiscovery.js +0 -77
  40. package/ServiceDiscovery.js.map +0 -1
  41. package/index.js.map +0 -1
  42. package/plugins/CompressorPlugin.d.ts +0 -14
  43. package/plugins/CompressorPlugin.js +0 -21
  44. package/plugins/CompressorPlugin.js.map +0 -1
  45. package/types.js.map +0 -1
@@ -1,14 +0,0 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import type { ICompressor } from "@webiny/utils/compression/Compressor";
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,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CompressorPlugin = void 0;
7
- var _Plugin = require("@webiny/plugins/Plugin");
8
- /**
9
- * Should never be initialized outside the api package.
10
- */
11
- class CompressorPlugin extends _Plugin.Plugin {
12
- name = "context.compressor";
13
- static type = "context.compressor";
14
- constructor(params) {
15
- super();
16
- this.getCompressor = params.getCompressor;
17
- }
18
- }
19
- exports.CompressorPlugin = CompressorPlugin;
20
-
21
- //# sourceMappingURL=CompressorPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_Plugin","require","CompressorPlugin","Plugin","name","type","constructor","params","getCompressor","exports"],"sources":["CompressorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { ICompressor } from \"@webiny/utils/compression/Compressor\";\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,IAAAA,OAAA,GAAAC,OAAA;AAOA;AACA;AACA;AACO,MAAMC,gBAAgB,SAASC,cAAM,CAAC;EAChBC,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;AAACC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
package/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ICompressor } from \"@webiny/utils/compression/Compressor\";\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 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 * Wait for property to be defined on the object and then execute the callable.\n * In case of multiple objects defined, wait for all of them.\n */\n waitFor: <T extends Context = Context>(\n obj: string[] | string,\n cb: (context: T) => void\n ) => 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":[]}