@tstdl/base 0.90.61 → 0.90.63

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.
@@ -1,4 +1,4 @@
1
- import type { InjectableOptionsWithoutLifecycle } from '../../injector/decorators.js';
1
+ import { type InjectableOptionsWithoutLifecycle } from '../../injector/decorators.js';
2
2
  import type { Constructor, Type } from '../../types.js';
3
3
  import type { ApiController, ApiDefinition } from '../types.js';
4
4
  type ApiDefinitionProvider = () => ApiDefinition;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-classes-per-file */
1
2
  import { Singleton } from '../../injector/decorators.js';
2
3
  import { objectEntries } from '../../utils/object/object.js';
3
4
  import { isFunction } from '../../utils/type-guards.js';
package/core.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import type { CancellationSignal } from './cancellation/token.js';
2
2
  import { Injector } from './injector/injector.js';
3
- import type { InjectionToken } from './injector/token.js';
4
- import type { LoggerArgument } from './logger/index.js';
5
- import { LogLevel, Logger } from './logger/index.js';
3
+ import { type InjectionToken } from './injector/token.js';
4
+ import { LogLevel, Logger, type LoggerArgument } from './logger/index.js';
6
5
  declare global {
7
6
  var tstdlLoaded: boolean | undefined;
8
7
  }
@@ -1,5 +1,4 @@
1
- import type { HttpValueMapInput } from './http-value-map.js';
2
- import { HttpValueMap } from './http-value-map.js';
1
+ import { HttpValueMap, type HttpValueMapInput } from './http-value-map.js';
3
2
  import type { HttpValueObject, NormalizedHttpValueObject } from './types.js';
4
3
  export type HttpQueryObject = HttpValueObject;
5
4
  export type NormalizedHttpQueryObject = NormalizedHttpValueObject;
@@ -1,10 +1,8 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import * as Http from 'node:http';
3
- import type { AsyncDisposable } from '../../../disposable/index.js';
4
- import { disposeAsync } from '../../../disposable/index.js';
3
+ import { disposeAsync, type AsyncDisposable } from '../../../disposable/index.js';
5
4
  import { Logger } from '../../../logger/index.js';
6
- import type { HttpServerRequestContext } from '../http-server.js';
7
- import { HttpServer } from '../http-server.js';
5
+ import { HttpServer, type HttpServerRequestContext } from '../http-server.js';
8
6
  export type NodeHttpServerContext = {
9
7
  nodeRequest: Http.IncomingMessage;
10
8
  nodeResponse: Http.ServerResponse;
@@ -1,5 +1,4 @@
1
- import type { ResolveManyItem, ResolveManyReturnType } from './injector.js';
2
- import { Injector } from './injector.js';
1
+ import { Injector, type ResolveManyItem, type ResolveManyReturnType } from './injector.js';
3
2
  import type { Resolvable, ResolveArgument } from './interfaces.js';
4
3
  import type { InjectionToken } from './token.js';
5
4
  import type { ResolveOptions } from './types.js';
@@ -1,13 +1,18 @@
1
- import type { AsyncDisposable } from '../disposable/disposable.js';
1
+ import { type AsyncDisposable } from '../disposable/disposable.js';
2
2
  import type { OneOrMany, Record, TypedOmit } from '../types.js';
3
- import type { InjectOptions } from './inject.js';
4
- import type { ResolveArgument } from './interfaces.js';
3
+ import { type InjectOptions } from './inject.js';
4
+ import { type ResolveArgument } from './interfaces.js';
5
5
  import { type Provider } from './provider.js';
6
6
  import { type InjectionToken } from './token.js';
7
7
  import type { RegistrationOptions, ResolveOptions } from './types.js';
8
+ export type ProvidersItem<T = any, A = any, D extends Record = Record> = Provider<T, A, D> & {
9
+ provide: InjectionToken<T, A>;
10
+ multi?: boolean;
11
+ };
8
12
  export type GlobalRegistration<T = any, A = any> = {
9
13
  token: InjectionToken<T, A>;
10
14
  provider: Provider<T, A>;
15
+ providers: ProvidersItem[];
11
16
  options: RegistrationOptions<T, A>;
12
17
  };
13
18
  export type Registration<T = any, A = any> = GlobalRegistration<T, A> & {
@@ -37,7 +42,7 @@ export declare class Injector implements AsyncDisposable {
37
42
  * @param provider provider used to resolve the token
38
43
  * @param options registration options
39
44
  */
40
- static register<T, A = any, C extends Record = Record>(token: InjectionToken<T, A>, providers: OneOrMany<Provider<T, A, C>>, options?: RegistrationOptions<T, A, C>): void;
45
+ static register<T, A = any, D extends Record = Record>(token: InjectionToken<T, A>, providers: OneOrMany<Provider<T, A, D>>, options?: RegistrationOptions<T, A, D>): void;
41
46
  /**
42
47
  * Globally register a provider for a token as a singleton. Alias for {@link register} with `singleton` lifecycle
43
48
  * @param token token to register
@@ -54,11 +54,13 @@ export class Injector {
54
54
  * @param options registration options
55
55
  */
56
56
  static register(token, providers, options = {}) {
57
+ const multi = isArray(providers);
57
58
  for (const provider of toArray(providers)) {
58
59
  const registration = {
59
60
  token,
60
61
  provider,
61
- options: { multi: isArray(providers), ...options }
62
+ providers: options.providers ?? [],
63
+ options: { multi, ...options }
62
64
  };
63
65
  addRegistration(Injector.#globalRegistrations, registration);
64
66
  }
@@ -93,11 +95,13 @@ export class Injector {
93
95
  */
94
96
  register(token, providers, options = {}) {
95
97
  this.assertNotDisposed();
98
+ const multi = isArray(providers);
96
99
  for (const provider of toArray(providers)) {
97
100
  const registration = {
98
101
  token,
99
102
  provider,
100
- options: { multi: isArray(providers), ...options },
103
+ providers: options.providers ?? [],
104
+ options: { multi, ...options },
101
105
  resolutions: new Map()
102
106
  };
103
107
  addRegistration(this.#registrations, registration);
@@ -125,20 +129,22 @@ export class Injector {
125
129
  * @param token token to get registration for
126
130
  */
127
131
  tryGetRegistration(token, options) {
128
- if (isNull(this.#parent) && !this.#registrations.has(token) && Injector.#globalRegistrations.has(token)) {
129
- const globalRegistrations = toArray(Injector.#globalRegistrations.get(token));
132
+ if (isNull(this.#parent) && !this.#registrations.has(token)) {
133
+ const globalRegistrations = toArray(Injector.#globalRegistrations.get(token) ?? []);
130
134
  for (const globalRegistration of globalRegistrations) {
131
135
  this.register(globalRegistration.token, globalRegistration.provider, globalRegistration.options);
132
136
  }
133
137
  }
134
- const ownRegistration = (options?.skipSelf != true) ? this.#registrations.get(token) : undefined;
135
- if (isDefined(ownRegistration)) {
136
- return ownRegistration;
138
+ if (options?.skipSelf != true) {
139
+ const ownRegistration = this.#registrations.get(token);
140
+ if (isDefined(ownRegistration)) {
141
+ return ownRegistration;
142
+ }
137
143
  }
138
- if (options?.onlySelf == true) {
139
- return undefined;
144
+ if (options?.onlySelf != true) {
145
+ return this.#parent?.tryGetRegistration(token);
140
146
  }
141
- return this.#parent?.tryGetRegistration(token);
147
+ return undefined;
142
148
  }
143
149
  /**
144
150
  * Get registration
@@ -212,17 +218,17 @@ export class Injector {
212
218
  throw new ResolveError('Token is undefined - this might be because of circular dependencies, use alias or forwardRef in this case.', chain);
213
219
  }
214
220
  const registration = (options.skipSelf == true) ? undefined : this.tryGetRegistration(token);
215
- if (isUndefined(registration)) {
216
- if (isNotNull(this.#parent) && (options.onlySelf != true)) {
217
- return this.#parent._resolve(token, argument, { ...options, skipSelf: false }, context, chain);
218
- }
219
- if (options.optional == true) {
220
- return undefined;
221
- }
222
- throw new ResolveError(`No provider for ${getTokenName(token)} registered.`, chain);
221
+ if (isDefined(registration)) {
222
+ const singleRegistration = isArray(registration) ? registration[0] : registration;
223
+ return this._resolveRegistration(singleRegistration, argument, options, context, chain);
224
+ }
225
+ if (isNotNull(this.#parent) && (options.onlySelf != true)) {
226
+ return this.#parent._resolve(token, argument, { ...options, skipSelf: false }, context, chain);
227
+ }
228
+ if (options.optional == true) {
229
+ return undefined;
223
230
  }
224
- const singleRegistration = isArray(registration) ? registration[0] : registration;
225
- return this._resolveRegistration(singleRegistration, argument, options, context, chain);
231
+ throw new ResolveError(`No provider for ${getTokenName(token)} registered.`, chain);
226
232
  }
227
233
  _resolveAll(token, argument, options, context, chain) {
228
234
  this.assertNotDisposed();
@@ -237,29 +243,33 @@ export class Injector {
237
243
  throw new ResolveError('Token is undefined - this might be because of circular dependencies, use alias or forwardRef in this case.', chain);
238
244
  }
239
245
  const registration = (options.skipSelf == true) ? undefined : this.tryGetRegistration(token);
240
- if (isUndefined(registration)) {
241
- if (isNotNull(this.#parent) && (options.onlySelf != true)) {
242
- return this.#parent._resolveAll(token, argument, { ...options, skipSelf: false }, context, chain);
243
- }
244
- if (options.optional == true) {
245
- return [];
246
- }
247
- throw new ResolveError(`No provider for ${getTokenName(token)} registered.`, chain);
246
+ if (isDefined(registration)) {
247
+ const registrations = isArray(registration) ? registration : [registration];
248
+ return registrations.map((reg) => this._resolveRegistration(reg, argument, options, context, chain));
248
249
  }
249
- const registrations = isArray(registration) ? registration : [registration];
250
- return registrations.map((reg) => this._resolveRegistration(reg, argument, options, context, chain));
250
+ if (isNotNull(this.#parent) && (options.onlySelf != true)) {
251
+ return this.#parent._resolveAll(token, argument, { ...options, skipSelf: false }, context, chain);
252
+ }
253
+ if (options.optional == true) {
254
+ return [];
255
+ }
256
+ throw new ResolveError(`No provider for ${getTokenName(token)} registered.`, chain);
251
257
  }
252
258
  _resolveRegistration(registration, argument, options, context, chain) {
253
259
  checkOverflow(chain, context);
254
- const injectionContext = this.getInjectionContext(context, argument, chain);
260
+ const { token, providers } = registration;
261
+ const injector = (providers.length > 0) ? this.fork('LocalProvidersInjector') : this;
262
+ for (const nestedProvider of providers) {
263
+ injector.register(nestedProvider.provide, nestedProvider, { multi: nestedProvider.multi });
264
+ }
265
+ const injectionContext = injector.getInjectionContext(context, argument, chain);
255
266
  const previousInjectionContext = setCurrentInjectionContext(injectionContext);
256
267
  const resolutionTag = Symbol(); // eslint-disable-line symbol-description
257
268
  try {
258
- const { token } = registration;
259
269
  const resolutionScoped = registration.options.lifecycle == 'resolution';
260
270
  const injectorScoped = registration.options.lifecycle == 'injector';
261
271
  const singletonScoped = registration.options.lifecycle == 'singleton';
262
- const resolveArgument = argument ?? registration.options.defaultArgument ?? (registration.options.defaultArgumentProvider?.(this.getResolveContext(resolutionTag, context, chain)));
272
+ const resolveArgument = argument ?? registration.options.defaultArgument ?? (registration.options.defaultArgumentProvider?.(injector.getResolveContext(resolutionTag, context, chain)));
263
273
  const argumentIdentity = resolveArgumentIdentity(registration, resolveArgument);
264
274
  if (resolutionScoped && context.resolutionScopedResolutions.hasFlat(token, argumentIdentity)) {
265
275
  return context.resolutionScopedResolutions.getFlat(token, argumentIdentity).value;
@@ -270,13 +280,13 @@ export class Injector {
270
280
  else if (singletonScoped && registration.resolutions.has(argumentIdentity)) {
271
281
  return registration.resolutions.get(argumentIdentity);
272
282
  }
273
- const value = this._resolveProvider(resolutionTag, registration, resolveArgument, options, context, injectionContext, chain);
283
+ const value = injector._resolveProvider(resolutionTag, registration, resolveArgument, options, context, injectionContext, chain);
274
284
  const resolution = {
275
285
  tag: resolutionTag,
276
286
  registration,
277
287
  value,
278
288
  argument: injectionContext.argument,
279
- afterResolveContext: this.getAfterResolveContext(resolutionTag, context),
289
+ afterResolveContext: injector.getAfterResolveContext(resolutionTag, context),
280
290
  chain
281
291
  };
282
292
  context.resolutions.push(resolution);
@@ -2,11 +2,11 @@ import type { CancellationSignal } from '../cancellation/index.js';
2
2
  import type { AsyncDisposeHandler } from '../disposable/async-disposer.js';
3
3
  import type { Record } from '../types.js';
4
4
  import type { ForwardRefTypeHint } from '../utils/object/forward-ref.js';
5
- import type { Injector } from './injector.js';
5
+ import type { Injector, ProvidersItem } from './injector.js';
6
6
  import type { ResolveArgument } from './interfaces.js';
7
7
  import type { InjectionToken } from './token.js';
8
8
  /**
9
- * transient: new resolution for every resolve
9
+ * Transient: new resolution for every resolve
10
10
  * resolution: one resolution per resolve tree
11
11
  * injector: one resolution per injector
12
12
  * singleton: one resolution at injector where token is registered
@@ -34,11 +34,13 @@ export type ResolveOptions<T, A> = {
34
34
  forwardRefTypeHint?: ForwardRefTypeHint;
35
35
  };
36
36
  /**
37
- * data to store between different stages like resolve and afterResolve
37
+ * Data to store between different stages like resolve and afterResolve
38
38
  */
39
39
  export type ResolveContextData<T extends Record> = T;
40
40
  export type RegistrationOptions<T, A = unknown, D extends Record = Record> = {
41
41
  lifecycle?: Lifecycle;
42
+ /** Local providers for inner resolutions */
43
+ providers?: ProvidersItem[];
42
44
  /** Default resolve argument used when neither token nor explicit resolve argument is provided */
43
45
  defaultArgument?: ResolveArgument<T, A>;
44
46
  /** Default resolve argument used when neither token nor explicit resolve argument is provided */
@@ -57,6 +59,6 @@ export type RegistrationOptions<T, A = unknown, D extends Record = Record> = {
57
59
  afterResolve?: (instance: T, argument: ResolveArgument<T, A>, context: AfterResolveContext<D>) => any;
58
60
  /** Whether multiple values can be resolved or not (used with {@link Injector.resolveAll}). If false, previous registrations are removed */
59
61
  multi?: boolean;
60
- /** custom metadata */
62
+ /** Custom metadata */
61
63
  metadata?: Record;
62
64
  };
@@ -1,74 +1,75 @@
1
- import type { Resolvable } from '../injector/interfaces.js';
2
- import { resolveArgumentType } from '../injector/interfaces.js';
1
+ import { resolveArgumentType, type Resolvable } from '../injector/interfaces.js';
3
2
  import type { ObjectMetadata, ObjectStorageObject } from './object.js';
4
3
  export type UploadObjectOptions = {
5
4
  metadata?: ObjectMetadata;
6
5
  };
7
6
  export type ObjectStorageArgument = string;
8
7
  export declare abstract class ObjectStorage implements Resolvable<ObjectStorageArgument> {
9
- /** object storage module */
8
+ /** Object storage module */
10
9
  readonly module: string;
11
10
  readonly [resolveArgumentType]: ObjectStorageArgument;
12
11
  constructor(module: string);
13
12
  /**
14
- * checks if an object exists
13
+ * Checks if an object exists
15
14
  * @param key object key
16
15
  */
17
16
  abstract exists(key: string): Promise<boolean>;
18
17
  /**
19
- * uploads an object
18
+ * Uploads an object
20
19
  * @param key object key
21
20
  * @param content content of object
22
21
  */
23
- abstract uploadObject(key: string, content: Uint8Array, options?: UploadObjectOptions): Promise<void>;
22
+ abstract uploadObject(key: string, content: Uint8Array | ReadableStream<Uint8Array>, options?: UploadObjectOptions): Promise<void>;
24
23
  /**
25
- * uploads an object stream
24
+ * Uploads an object stream
26
25
  * @param key object key
27
26
  * @param stream stream of object
27
+ * @deprecated use {@link uploadObject} instead
28
28
  */
29
29
  abstract uploadObjectStream(key: string, stream: ReadableStream<Uint8Array>, options?: UploadObjectOptions): Promise<void>;
30
30
  /**
31
- * get an url which can be used to upload the object without further authorization
31
+ * Get an url which can be used to upload the object without further authorization
32
32
  * @param key object key
33
33
  * @param expirationTimestamp timestamp when the url expires and can no longer be used
34
34
  */
35
35
  abstract getUploadUrl(key: string, expirationTimestamp: number): Promise<string>;
36
36
  /**
37
- * get all objects
37
+ * Get all objects
38
38
  */
39
39
  abstract getObjects(): Promise<ObjectStorageObject[]>;
40
40
  /**
41
- * get all objects
41
+ * Get all objects
42
42
  */
43
43
  abstract getObjectsCursor(): AsyncIterable<ObjectStorageObject>;
44
44
  /**
45
- * get object
45
+ * Get object
46
46
  * @param key object key
47
47
  */
48
48
  abstract getObject(key: string): Promise<ObjectStorageObject>;
49
49
  /**
50
- * get object resource uri
50
+ * Get object resource uri
51
51
  * @param key object key
52
52
  */
53
53
  abstract getResourceUri(key: string): Promise<string>;
54
54
  /**
55
- * get stream of object content
55
+ * Get stream of object content
56
56
  * @param key object key
57
57
  */
58
58
  abstract getContentStream(key: string): ReadableStream<Uint8Array>;
59
59
  /**
60
- * get an url which can be used to download the object without further authorization
60
+ * Get an url which can be used to download the object without further authorization
61
61
  * @param key object key
62
62
  * @param expirationTimestamp timestamp when the url expires and can no longer be used
63
+ * @param responseHeaders headers used for download response
63
64
  */
64
- abstract getDownloadUrl(key: string, expirationTimestamp: number): Promise<string>;
65
+ abstract getDownloadUrl(key: string, expirationTimestamp: number, responseHeaders?: Record<string, string>): Promise<string>;
65
66
  /**
66
- * deletes an object
67
+ * Deletes an object
67
68
  * @param key object key
68
69
  */
69
70
  abstract deleteObject(key: string): Promise<void>;
70
71
  /**
71
- * deletes objects
72
+ * Deletes objects
72
73
  * @param keys object key
73
74
  */
74
75
  abstract deleteObjects(keys: string[]): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { resolveArgumentType } from '../injector/interfaces.js';
2
2
  export class ObjectStorage {
3
- /** object storage module */
3
+ /** Object storage module */
4
4
  module;
5
5
  constructor(module) {
6
6
  this.module = module;
@@ -1,7 +1,5 @@
1
- import type { BucketItemStat } from 'minio';
2
- import { Client } from 'minio';
3
- import type { UploadObjectOptions } from '../../object-storage/index.js';
4
- import { ObjectStorage } from '../../object-storage/index.js';
1
+ import type { BucketItemStat, Client } from 'minio';
2
+ import { ObjectStorage, type UploadObjectOptions } from '../../object-storage/index.js';
5
3
  import { S3Object } from './s3.object.js';
6
4
  export declare class S3ObjectStorage extends ObjectStorage {
7
5
  private readonly client;
@@ -13,7 +11,7 @@ export declare class S3ObjectStorage extends ObjectStorage {
13
11
  }): Promise<void>;
14
12
  exists(key: string): Promise<boolean>;
15
13
  statObject(key: string): Promise<BucketItemStat>;
16
- uploadObject(key: string, content: Uint8Array, options?: UploadObjectOptions): Promise<void>;
14
+ uploadObject(key: string, content: Uint8Array | ReadableStream<Uint8Array>, options?: UploadObjectOptions): Promise<void>;
17
15
  uploadObjectStream(key: string, stream: ReadableStream<Uint8Array>, options?: UploadObjectOptions): Promise<void>;
18
16
  getContent(key: string): Promise<Uint8Array>;
19
17
  getContentStream(key: string): ReadableStream<Uint8Array>;
@@ -21,7 +19,7 @@ export declare class S3ObjectStorage extends ObjectStorage {
21
19
  getObjectsCursor(): AsyncIterable<S3Object>;
22
20
  getObject(key: string): Promise<S3Object>;
23
21
  getResourceUri(key: string): Promise<string>;
24
- getDownloadUrl(key: string, expirationTimestamp: number): Promise<string>;
22
+ getDownloadUrl(key: string, expirationTimestamp: number, responseHeaders?: Record<string, string>): Promise<string>;
25
23
  getUploadUrl(key: string, expirationTimestamp: number): Promise<string>;
26
24
  deleteObject(key: string): Promise<void>;
27
25
  deleteObjects(keys: string[]): Promise<void>;
@@ -8,7 +8,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { Readable } from 'node:stream';
11
- import { Client } from 'minio';
12
11
  import { Singleton } from '../../injector/decorators.js';
13
12
  import { ObjectStorage } from '../../object-storage/index.js';
14
13
  import { mapAsync } from '../../utils/async-iterable-helpers/map.js';
@@ -16,7 +15,7 @@ import { toArrayAsync } from '../../utils/async-iterable-helpers/to-array.js';
16
15
  import { now } from '../../utils/date-time.js';
17
16
  import { readableStreamFromPromise } from '../../utils/stream/index.js';
18
17
  import { readBinaryStream } from '../../utils/stream/stream-reader.js';
19
- import { assertStringPass, isObject } from '../../utils/type-guards.js';
18
+ import { assertStringPass, isObject, isUint8Array } from '../../utils/type-guards.js';
20
19
  import { S3ObjectStorageProvider } from './s3.object-storage-provider.js';
21
20
  import { S3Object } from './s3.object.js';
22
21
  let S3ObjectStorage = class S3ObjectStorage extends ObjectStorage {
@@ -55,16 +54,20 @@ let S3ObjectStorage = class S3ObjectStorage extends ObjectStorage {
55
54
  }
56
55
  async uploadObject(key, content, options) {
57
56
  const bucketKey = this.getBucketKey(key);
58
- await this.client.putObject(this.bucket, bucketKey, Buffer.from(content), options?.metadata);
57
+ if (isUint8Array(content)) {
58
+ await this.client.putObject(this.bucket, bucketKey, Buffer.from(content), options?.metadata);
59
+ }
60
+ else {
61
+ const readable = Readable.fromWeb(content);
62
+ const errorPromise = new Promise((_, reject) => readable.on('error', reject));
63
+ await Promise.race([
64
+ this.client.putObject(this.bucket, bucketKey, readable, options?.metadata),
65
+ errorPromise
66
+ ]);
67
+ }
59
68
  }
60
69
  async uploadObjectStream(key, stream, options) {
61
- const bucketKey = this.getBucketKey(key);
62
- const readable = Readable.fromWeb(stream);
63
- const errorPromise = new Promise((_, reject) => readable.on('error', reject));
64
- await Promise.race([
65
- this.client.putObject(this.bucket, bucketKey, readable, options?.metadata),
66
- errorPromise
67
- ]);
70
+ return this.uploadObject(key, stream, options);
68
71
  }
69
72
  async getContent(key) {
70
73
  const bucketKey = this.getBucketKey(key);
@@ -93,10 +96,10 @@ let S3ObjectStorage = class S3ObjectStorage extends ObjectStorage {
93
96
  async getResourceUri(key) {
94
97
  return this.getResourceUriSync(key);
95
98
  }
96
- async getDownloadUrl(key, expirationTimestamp) {
99
+ async getDownloadUrl(key, expirationTimestamp, responseHeaders) {
97
100
  const bucketKey = this.getBucketKey(key);
98
101
  const { date, expiration } = getDateAndExpiration(expirationTimestamp);
99
- return this.client.presignedGetObject(this.bucket, bucketKey, expiration, {}, date);
102
+ return this.client.presignedGetObject(this.bucket, bucketKey, expiration, responseHeaders, date);
100
103
  }
101
104
  async getUploadUrl(key, expirationTimestamp) {
102
105
  const bucketKey = this.getBucketKey(key);
@@ -131,7 +134,7 @@ S3ObjectStorage = __decorate([
131
134
  }
132
135
  }
133
136
  }),
134
- __metadata("design:paramtypes", [Client, String, String, String])
137
+ __metadata("design:paramtypes", [Function, String, String, String])
135
138
  ], S3ObjectStorage);
136
139
  export { S3ObjectStorage };
137
140
  function getDateAndExpiration(expirationTimestamp) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.90.61",
3
+ "version": "0.90.63",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -105,11 +105,11 @@
105
105
  "./utils/string": "./utils/object/index.js"
106
106
  },
107
107
  "dependencies": {
108
- "disposablestack": "^1.1",
108
+ "core-js": "3.36",
109
109
  "luxon": "^3.4",
110
110
  "reflect-metadata": "^0.2",
111
111
  "rxjs": "^7.8",
112
- "type-fest": "4.14"
112
+ "type-fest": "4.15"
113
113
  },
114
114
  "devDependencies": {
115
115
  "@mxssfd/typedoc-theme": "1.1",
@@ -130,10 +130,10 @@
130
130
  "typedoc": "0.25",
131
131
  "typedoc-plugin-missing-exports": "2.2",
132
132
  "typescript": "5.4",
133
- "typescript-eslint": "7.3"
133
+ "typescript-eslint": "7.7"
134
134
  },
135
135
  "peerDependencies": {
136
- "@elastic/elasticsearch": "^8.12",
136
+ "@elastic/elasticsearch": "^8.13",
137
137
  "@koa/router": "^12.0",
138
138
  "@tstdl/angular": "^0.90",
139
139
  "@zxcvbn-ts/core": "^3.0",
@@ -147,10 +147,10 @@
147
147
  "mjml": "^4.15",
148
148
  "mongodb": "^6.5",
149
149
  "nodemailer": "^6.9",
150
- "playwright": "^1.42",
150
+ "playwright": "^1.43",
151
151
  "preact": "^10.20",
152
152
  "preact-render-to-string": "^6.4",
153
- "undici": "^6.10",
153
+ "undici": "^6.13",
154
154
  "urlpattern-polyfill": "^10.0"
155
155
  },
156
156
  "peerDependenciesMeta": {
package/polyfills.d.ts CHANGED
@@ -1,159 +1,2 @@
1
- import 'disposablestack/auto';
2
- declare global {
3
- interface SymbolConstructor {
4
- /**
5
- * A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
6
- */
7
- readonly dispose: unique symbol;
8
- /**
9
- * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
10
- */
11
- readonly asyncDispose: unique symbol;
12
- }
13
- interface Disposable {
14
- [Symbol.dispose](): void;
15
- }
16
- interface AsyncDisposable {
17
- [Symbol.asyncDispose](): PromiseLike<void>;
18
- }
19
- interface SuppressedError extends Error {
20
- error: any;
21
- suppressed: any;
22
- }
23
- interface SuppressedErrorConstructor extends ErrorConstructor {
24
- new (error: any, suppressed: any, message?: string): SuppressedError;
25
- (error: any, suppressed: any, message?: string): SuppressedError;
26
- readonly prototype: SuppressedError;
27
- }
28
- var SuppressedError: SuppressedErrorConstructor;
29
- interface DisposableStack {
30
- /**
31
- * Returns a value indicating whether this stack has been disposed.
32
- */
33
- readonly disposed: boolean;
34
- /**
35
- * Disposes each resource in the stack in the reverse order that they were added.
36
- */
37
- dispose(): void;
38
- /**
39
- * Adds a disposable resource to the stack, returning the resource.
40
- * @param value The resource to add. `null` and `undefined` will not be added, but will be returned.
41
- * @returns The provided {@link value}.
42
- */
43
- use<T extends Disposable | null | undefined>(value: T): T;
44
- /**
45
- * Adds a value and associated disposal callback as a resource to the stack.
46
- * @param value The value to add.
47
- * @param onDispose The callback to use in place of a `[Symbol.dispose]()` method. Will be invoked with `value`
48
- * as the first parameter.
49
- * @returns The provided {@link value}.
50
- */
51
- adopt<T>(value: T, onDispose: (value: T) => void): T;
52
- /**
53
- * Adds a callback to be invoked when the stack is disposed.
54
- */
55
- defer(onDispose: () => void): void;
56
- /**
57
- * Move all resources out of this stack and into a new `DisposableStack`, and marks this stack as disposed.
58
- * @example
59
- * ```ts
60
- * class C {
61
- * #res1: Disposable;
62
- * #res2: Disposable;
63
- * #disposables: DisposableStack;
64
- * constructor() {
65
- * // stack will be disposed when exiting constructor for any reason
66
- * using stack = new DisposableStack();
67
- *
68
- * // get first resource
69
- * this.#res1 = stack.use(getResource1());
70
- *
71
- * // get second resource. If this fails, both `stack` and `#res1` will be disposed.
72
- * this.#res2 = stack.use(getResource2());
73
- *
74
- * // all operations succeeded, move resources out of `stack` so that they aren't disposed
75
- * // when constructor exits
76
- * this.#disposables = stack.move();
77
- * }
78
- *
79
- * [Symbol.dispose]() {
80
- * this.#disposables.dispose();
81
- * }
82
- * }
83
- * ```
84
- */
85
- move(): DisposableStack;
86
- [Symbol.dispose](): void;
87
- readonly [Symbol.toStringTag]: string;
88
- }
89
- interface DisposableStackConstructor {
90
- new (): DisposableStack;
91
- readonly prototype: DisposableStack;
92
- }
93
- var DisposableStack: DisposableStackConstructor;
94
- interface AsyncDisposableStack {
95
- /**
96
- * Returns a value indicating whether this stack has been disposed.
97
- */
98
- readonly disposed: boolean;
99
- /**
100
- * Disposes each resource in the stack in the reverse order that they were added.
101
- */
102
- disposeAsync(): Promise<void>;
103
- /**
104
- * Adds a disposable resource to the stack, returning the resource.
105
- * @param value The resource to add. `null` and `undefined` will not be added, but will be returned.
106
- * @returns The provided {@link value}.
107
- */
108
- use<T extends AsyncDisposable | Disposable | null | undefined>(value: T): T;
109
- /**
110
- * Adds a value and associated disposal callback as a resource to the stack.
111
- * @param value The value to add.
112
- * @param onDisposeAsync The callback to use in place of a `[Symbol.asyncDispose]()` method. Will be invoked with `value`
113
- * as the first parameter.
114
- * @returns The provided {@link value}.
115
- */
116
- adopt<T>(value: T, onDisposeAsync: (value: T) => PromiseLike<void> | void): T;
117
- /**
118
- * Adds a callback to be invoked when the stack is disposed.
119
- */
120
- defer(onDisposeAsync: () => PromiseLike<void> | void): void;
121
- /**
122
- * Move all resources out of this stack and into a new `DisposableStack`, and marks this stack as disposed.
123
- * @example
124
- * ```ts
125
- * class C {
126
- * #res1: Disposable;
127
- * #res2: Disposable;
128
- * #disposables: DisposableStack;
129
- * constructor() {
130
- * // stack will be disposed when exiting constructor for any reason
131
- * using stack = new DisposableStack();
132
- *
133
- * // get first resource
134
- * this.#res1 = stack.use(getResource1());
135
- *
136
- * // get second resource. If this fails, both `stack` and `#res1` will be disposed.
137
- * this.#res2 = stack.use(getResource2());
138
- *
139
- * // all operations succeeded, move resources out of `stack` so that they aren't disposed
140
- * // when constructor exits
141
- * this.#disposables = stack.move();
142
- * }
143
- *
144
- * [Symbol.dispose]() {
145
- * this.#disposables.dispose();
146
- * }
147
- * }
148
- * ```
149
- */
150
- move(): AsyncDisposableStack;
151
- [Symbol.asyncDispose](): Promise<void>;
152
- readonly [Symbol.toStringTag]: string;
153
- }
154
- interface AsyncDisposableStackConstructor {
155
- new (): AsyncDisposableStack;
156
- readonly prototype: AsyncDisposableStack;
157
- }
158
- var AsyncDisposableStack: AsyncDisposableStackConstructor;
159
- }
1
+ import 'core-js/actual/async-disposable-stack/index.js';
2
+ import 'core-js/actual/disposable-stack/index.js';
package/polyfills.js CHANGED
@@ -1 +1,2 @@
1
- import 'disposablestack/auto';
1
+ import 'core-js/actual/async-disposable-stack/index.js';
2
+ import 'core-js/actual/disposable-stack/index.js';
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata/lite';
2
2
  import type { ConstructorParameterDecorator } from '../types.js';
3
3
  import type { Decorator, DecoratorHandler } from './types.js';
4
- import type { CreateDecoratorOptions, SpecificCreateDecoratorOptions } from './utils.js';
4
+ import { type CreateDecoratorOptions, type SpecificCreateDecoratorOptions } from './utils.js';
5
5
  export declare function Decorate({ handler, ...options }?: CreateDecoratorOptions & {
6
6
  handler?: DecoratorHandler;
7
7
  }): Decorator;