@velajs/cloudflare 0.1.1 → 1.1.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +52 -39
  3. package/dist/binding-ref.d.ts +2 -9
  4. package/dist/binding-ref.js +6 -10
  5. package/dist/cloudflare-application.d.ts +6 -6
  6. package/dist/cloudflare-application.js +35 -19
  7. package/dist/cloudflare-factory.d.ts +5 -8
  8. package/dist/cloudflare-factory.js +37 -26
  9. package/dist/index.d.ts +1 -4
  10. package/dist/index.js +1 -5
  11. package/dist/modules/ai.module.d.ts +1 -6
  12. package/dist/modules/ai.module.js +7 -30
  13. package/dist/modules/create-binding-module.d.ts +14 -0
  14. package/dist/modules/create-binding-module.js +26 -0
  15. package/dist/modules/d1.module.d.ts +1 -6
  16. package/dist/modules/d1.module.js +7 -30
  17. package/dist/modules/durable-object.module.d.ts +1 -6
  18. package/dist/modules/durable-object.module.js +7 -30
  19. package/dist/modules/hyperdrive.module.d.ts +1 -6
  20. package/dist/modules/hyperdrive.module.js +7 -30
  21. package/dist/modules/kv.module.d.ts +1 -6
  22. package/dist/modules/kv.module.js +7 -30
  23. package/dist/modules/queue.module.d.ts +1 -6
  24. package/dist/modules/queue.module.js +7 -30
  25. package/dist/modules/r2.module.d.ts +1 -6
  26. package/dist/modules/r2.module.js +7 -30
  27. package/dist/modules/vectorize.module.d.ts +1 -6
  28. package/dist/modules/vectorize.module.js +7 -30
  29. package/dist/services/ai.service.d.ts +2 -12
  30. package/dist/services/ai.service.js +1 -4
  31. package/dist/services/d1.service.d.ts +2 -18
  32. package/dist/services/d1.service.js +1 -15
  33. package/dist/services/durable-object.service.d.ts +2 -20
  34. package/dist/services/durable-object.service.js +1 -16
  35. package/dist/services/hyperdrive.service.d.ts +2 -16
  36. package/dist/services/hyperdrive.service.js +1 -1
  37. package/dist/services/kv.service.d.ts +5 -18
  38. package/dist/services/kv.service.js +1 -16
  39. package/dist/services/queue.service.d.ts +3 -17
  40. package/dist/services/queue.service.js +1 -7
  41. package/dist/services/r2.service.d.ts +2 -14
  42. package/dist/services/r2.service.js +1 -16
  43. package/dist/services/vectorize.service.d.ts +2 -22
  44. package/dist/services/vectorize.service.js +1 -19
  45. package/dist/tokens.d.ts +0 -7
  46. package/dist/tokens.js +1 -9
  47. package/package.json +19 -13
@@ -0,0 +1,26 @@
1
+ import { createModuleRef } from "@velajs/vela";
2
+ import { BindingRef } from "../binding-ref.js";
3
+ // Single factory for every Cloudflare binding module (KV, D1, R2, ...).
4
+ // Each binding module is just a bag of (token, service); this generates
5
+ // the canonical forRoot() shape for them.
6
+ export function createBindingModule(opts) {
7
+ return {
8
+ forRoot ({ binding }) {
9
+ const ref = new BindingRef(binding);
10
+ return {
11
+ module: createModuleRef(`${opts.name}Module_${binding}`),
12
+ providers: [
13
+ {
14
+ provide: opts.bindingRefToken,
15
+ useValue: ref
16
+ },
17
+ opts.serviceClass
18
+ ],
19
+ exports: [
20
+ opts.serviceClass,
21
+ opts.bindingRefToken
22
+ ]
23
+ };
24
+ }
25
+ };
26
+ }
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class D1Module {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const D1Module: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { D1_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { D1Service } from "../services/d1.service.js";
5
- export class D1Module {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class D1DynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `D1Module_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- D1Service,
17
- D1_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: D1_BINDING_REF,
25
- useValue: ref
26
- },
27
- D1Service
28
- ]
29
- };
30
- }
31
- }
2
+ import { D1_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const D1Module = createBindingModule({
5
+ name: 'D1',
6
+ serviceClass: D1Service,
7
+ bindingRefToken: D1_BINDING_REF
8
+ });
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class DurableObjectModule {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const DurableObjectModule: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { DO_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { DurableObjectService } from "../services/durable-object.service.js";
5
- export class DurableObjectModule {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class DurableObjectDynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `DurableObjectModule_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- DurableObjectService,
17
- DO_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: DO_BINDING_REF,
25
- useValue: ref
26
- },
27
- DurableObjectService
28
- ]
29
- };
30
- }
31
- }
2
+ import { DO_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const DurableObjectModule = createBindingModule({
5
+ name: 'DurableObject',
6
+ serviceClass: DurableObjectService,
7
+ bindingRefToken: DO_BINDING_REF
8
+ });
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class HyperdriveModule {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const HyperdriveModule: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { HYPERDRIVE_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { HyperdriveService } from "../services/hyperdrive.service.js";
5
- export class HyperdriveModule {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class HyperdriveDynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `HyperdriveModule_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- HyperdriveService,
17
- HYPERDRIVE_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: HYPERDRIVE_BINDING_REF,
25
- useValue: ref
26
- },
27
- HyperdriveService
28
- ]
29
- };
30
- }
31
- }
2
+ import { HYPERDRIVE_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const HyperdriveModule = createBindingModule({
5
+ name: 'Hyperdrive',
6
+ serviceClass: HyperdriveService,
7
+ bindingRefToken: HYPERDRIVE_BINDING_REF
8
+ });
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class KVModule {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const KVModule: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { KV_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { KVService } from "../services/kv.service.js";
5
- export class KVModule {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class KVDynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `KVModule_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- KVService,
17
- KV_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: KV_BINDING_REF,
25
- useValue: ref
26
- },
27
- KVService
28
- ]
29
- };
30
- }
31
- }
2
+ import { KV_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const KVModule = createBindingModule({
5
+ name: 'KV',
6
+ serviceClass: KVService,
7
+ bindingRefToken: KV_BINDING_REF
8
+ });
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class QueueModule {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const QueueModule: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { QUEUE_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { QueueService } from "../services/queue.service.js";
5
- export class QueueModule {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class QueueDynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `QueueModule_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- QueueService,
17
- QUEUE_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: QUEUE_BINDING_REF,
25
- useValue: ref
26
- },
27
- QueueService
28
- ]
29
- };
30
- }
31
- }
2
+ import { QUEUE_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const QueueModule = createBindingModule({
5
+ name: 'Queue',
6
+ serviceClass: QueueService,
7
+ bindingRefToken: QUEUE_BINDING_REF
8
+ });
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class R2Module {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const R2Module: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { R2_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { R2Service } from "../services/r2.service.js";
5
- export class R2Module {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class R2DynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `R2Module_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- R2Service,
17
- R2_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: R2_BINDING_REF,
25
- useValue: ref
26
- },
27
- R2Service
28
- ]
29
- };
30
- }
31
- }
2
+ import { R2_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const R2Module = createBindingModule({
5
+ name: 'R2',
6
+ serviceClass: R2Service,
7
+ bindingRefToken: R2_BINDING_REF
8
+ });
@@ -1,6 +1 @@
1
- import type { DynamicModule } from '@velajs/vela';
2
- export declare class VectorizeModule {
3
- static forRoot(options: {
4
- binding: string;
5
- }): DynamicModule;
6
- }
1
+ export declare const VectorizeModule: import("./create-binding-module").BindingModuleStatic;
@@ -1,31 +1,8 @@
1
- import { MetadataRegistry } from "@velajs/vela";
2
- import { BindingRef } from "../binding-ref.js";
3
- import { VECTORIZE_BINDING_REF, bindingsRegistry } from "../tokens.js";
4
1
  import { VectorizeService } from "../services/vectorize.service.js";
5
- export class VectorizeModule {
6
- static forRoot(options) {
7
- const ref = new BindingRef(options.binding);
8
- bindingsRegistry.push(ref);
9
- const moduleClass = class VectorizeDynamicModule {
10
- };
11
- Object.defineProperty(moduleClass, 'name', {
12
- value: `VectorizeModule_${options.binding}`
13
- });
14
- MetadataRegistry.setModuleOptions(moduleClass, {
15
- exports: [
16
- VectorizeService,
17
- VECTORIZE_BINDING_REF
18
- ]
19
- });
20
- return {
21
- module: moduleClass,
22
- providers: [
23
- {
24
- token: VECTORIZE_BINDING_REF,
25
- useValue: ref
26
- },
27
- VectorizeService
28
- ]
29
- };
30
- }
31
- }
2
+ import { VECTORIZE_BINDING_REF } from "../tokens.js";
3
+ import { createBindingModule } from "./create-binding-module.js";
4
+ export const VectorizeModule = createBindingModule({
5
+ name: 'Vectorize',
6
+ serviceClass: VectorizeService,
7
+ bindingRefToken: VECTORIZE_BINDING_REF
8
+ });
@@ -1,16 +1,6 @@
1
1
  import type { BindingRef } from '../binding-ref';
2
- type AIBinding = {
3
- run: Function;
4
- } & Record<string, any>;
5
- /**
6
- * Wrapper around Cloudflare Workers AI binding.
7
- * Injected via `AIModule.forRoot({ binding: 'AI' })`.
8
- */
9
2
  export declare class AIService {
10
3
  private ref;
11
- constructor(ref: BindingRef);
12
- /** Access the raw Ai binding directly. */
13
- get binding(): AIBinding;
14
- run(model: string, inputs: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
4
+ constructor(ref: BindingRef<Ai>);
5
+ get binding(): Ai;
15
6
  }
16
- export {};
@@ -19,12 +19,9 @@ export class AIService {
19
19
  constructor(ref){
20
20
  this.ref = ref;
21
21
  }
22
- /** Access the raw Ai binding directly. */ get binding() {
22
+ get binding() {
23
23
  return this.ref.value;
24
24
  }
25
- run(model, inputs, options) {
26
- return this.binding.run(model, inputs, options);
27
- }
28
25
  }
29
26
  AIService = _ts_decorate([
30
27
  Injectable(),
@@ -1,22 +1,6 @@
1
1
  import type { BindingRef } from '../binding-ref';
2
- type D1Binding = {
3
- prepare: Function;
4
- batch: Function;
5
- exec: Function;
6
- dump: Function;
7
- } & Record<string, any>;
8
- /**
9
- * Wrapper around Cloudflare D1 Database.
10
- * Injected via `D1Module.forRoot({ binding: 'DB' })`.
11
- */
12
2
  export declare class D1Service {
13
3
  private ref;
14
- constructor(ref: BindingRef);
15
- /** Access the raw D1Database binding directly. */
16
- get database(): D1Binding;
17
- prepare(query: string): any;
18
- batch(statements: unknown[]): Promise<any[]>;
19
- exec(query: string): Promise<unknown>;
20
- dump(): Promise<ArrayBuffer>;
4
+ constructor(ref: BindingRef<D1Database>);
5
+ get database(): D1Database;
21
6
  }
22
- export {};
@@ -19,23 +19,9 @@ export class D1Service {
19
19
  constructor(ref){
20
20
  this.ref = ref;
21
21
  }
22
- /** Access the raw D1Database binding directly. */ get database() {
22
+ get database() {
23
23
  return this.ref.value;
24
24
  }
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- prepare(query) {
27
- return this.database.prepare(query);
28
- }
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- batch(statements) {
31
- return this.database.batch(statements);
32
- }
33
- exec(query) {
34
- return this.database.exec(query);
35
- }
36
- dump() {
37
- return this.database.dump();
38
- }
39
25
  }
40
26
  D1Service = _ts_decorate([
41
27
  Injectable(),
@@ -1,24 +1,6 @@
1
1
  import type { BindingRef } from '../binding-ref';
2
- type DOBinding = {
3
- newUniqueId: Function;
4
- idFromName: Function;
5
- idFromString: Function;
6
- get: Function;
7
- jurisdiction: Function;
8
- } & Record<string, any>;
9
- /**
10
- * Wrapper around Cloudflare DurableObjectNamespace.
11
- * Injected via `DurableObjectModule.forRoot({ binding: 'COUNTER' })`.
12
- */
13
2
  export declare class DurableObjectService {
14
3
  private ref;
15
- constructor(ref: BindingRef);
16
- /** Access the raw DurableObjectNamespace binding directly. */
17
- get namespace(): DOBinding;
18
- newUniqueId(options?: Record<string, unknown>): unknown;
19
- idFromName(name: string): unknown;
20
- idFromString(hexStr: string): unknown;
21
- get(id: unknown): unknown;
22
- jurisdiction(name: string): unknown;
4
+ constructor(ref: BindingRef<DurableObjectNamespace>);
5
+ get namespace(): DurableObjectNamespace;
23
6
  }
24
- export {};
@@ -19,24 +19,9 @@ export class DurableObjectService {
19
19
  constructor(ref){
20
20
  this.ref = ref;
21
21
  }
22
- /** Access the raw DurableObjectNamespace binding directly. */ get namespace() {
22
+ get namespace() {
23
23
  return this.ref.value;
24
24
  }
25
- newUniqueId(options) {
26
- return this.namespace.newUniqueId(options);
27
- }
28
- idFromName(name) {
29
- return this.namespace.idFromName(name);
30
- }
31
- idFromString(hexStr) {
32
- return this.namespace.idFromString(hexStr);
33
- }
34
- get(id) {
35
- return this.namespace.get(id);
36
- }
37
- jurisdiction(name) {
38
- return this.namespace.jurisdiction(name);
39
- }
40
25
  }
41
26
  DurableObjectService = _ts_decorate([
42
27
  Injectable(),
@@ -1,21 +1,8 @@
1
1
  import type { BindingRef } from '../binding-ref';
2
- type HyperdriveBinding = {
3
- connectionString: string;
4
- host: string;
5
- port: number;
6
- user: string;
7
- password: string;
8
- database: string;
9
- } & Record<string, any>;
10
- /**
11
- * Wrapper around Cloudflare Hyperdrive binding.
12
- * Injected via `HyperdriveModule.forRoot({ binding: 'POSTGRES' })`.
13
- */
14
2
  export declare class HyperdriveService {
15
3
  private ref;
16
- constructor(ref: BindingRef);
17
- /** Access the raw Hyperdrive binding directly. */
18
- get binding(): HyperdriveBinding;
4
+ constructor(ref: BindingRef<Hyperdrive>);
5
+ get binding(): Hyperdrive;
19
6
  get connectionString(): string;
20
7
  get host(): string;
21
8
  get port(): number;
@@ -23,4 +10,3 @@ export declare class HyperdriveService {
23
10
  get password(): string;
24
11
  get database(): string;
25
12
  }
26
- export {};
@@ -19,7 +19,7 @@ export class HyperdriveService {
19
19
  constructor(ref){
20
20
  this.ref = ref;
21
21
  }
22
- /** Access the raw Hyperdrive binding directly. */ get binding() {
22
+ get binding() {
23
23
  return this.ref.value;
24
24
  }
25
25
  get connectionString() {
@@ -1,24 +1,11 @@
1
1
  import type { BindingRef } from '../binding-ref';
2
- type KVBinding = {
3
- get: Function;
4
- getWithMetadata: Function;
5
- put: Function;
6
- delete: Function;
7
- list: Function;
8
- } & Record<string, any>;
9
2
  /**
10
- * Wrapper around Cloudflare KV Namespace.
11
- * Injected via `KVModule.forRoot({ binding: 'MY_KV' })`.
3
+ * Wrapper around a Cloudflare KV namespace binding.
4
+ * Use `kv.namespace.get(...)`, `kv.namespace.put(...)`, etc. the namespace
5
+ * is the standard @cloudflare/workers-types `KVNamespace`.
12
6
  */
13
7
  export declare class KVService {
14
8
  private ref;
15
- constructor(ref: BindingRef);
16
- /** Access the raw KVNamespace binding directly. */
17
- get namespace(): KVBinding;
18
- get(key: string, typeOrOptions?: string | Record<string, unknown>): Promise<unknown>;
19
- getWithMetadata(key: string, typeOrOptions?: string | Record<string, unknown>): Promise<unknown>;
20
- put(key: string, value: string | ArrayBuffer | ReadableStream, options?: Record<string, unknown>): Promise<void>;
21
- delete(key: string): Promise<void>;
22
- list(options?: Record<string, unknown>): Promise<unknown>;
9
+ constructor(ref: BindingRef<KVNamespace>);
10
+ get namespace(): KVNamespace;
23
11
  }
24
- export {};
@@ -19,24 +19,9 @@ export class KVService {
19
19
  constructor(ref){
20
20
  this.ref = ref;
21
21
  }
22
- /** Access the raw KVNamespace binding directly. */ get namespace() {
22
+ get namespace() {
23
23
  return this.ref.value;
24
24
  }
25
- get(key, typeOrOptions) {
26
- return this.namespace.get(key, typeOrOptions);
27
- }
28
- getWithMetadata(key, typeOrOptions) {
29
- return this.namespace.getWithMetadata(key, typeOrOptions);
30
- }
31
- put(key, value, options) {
32
- return this.namespace.put(key, value, options);
33
- }
34
- delete(key) {
35
- return this.namespace.delete(key);
36
- }
37
- list(options) {
38
- return this.namespace.list(options);
39
- }
40
25
  }
41
26
  KVService = _ts_decorate([
42
27
  Injectable(),
@@ -1,20 +1,6 @@
1
1
  import type { BindingRef } from '../binding-ref';
2
- type QueueBinding = Record<string, any>;
3
- /**
4
- * Wrapper around Cloudflare Queue (producer side).
5
- * Injected via `QueueModule.forRoot({ binding: 'MY_QUEUE' })`.
6
- *
7
- * For consuming messages, use the `@QueueConsumer()` decorator.
8
- */
9
- export declare class QueueService {
2
+ export declare class QueueService<Body = unknown> {
10
3
  private ref;
11
- constructor(ref: BindingRef);
12
- /** Access the raw Queue binding directly. */
13
- get queue(): QueueBinding;
14
- send(message: unknown, options?: Record<string, unknown>): Promise<void>;
15
- sendBatch(messages: Iterable<{
16
- body: unknown;
17
- [key: string]: unknown;
18
- }>, options?: Record<string, unknown>): Promise<void>;
4
+ constructor(ref: BindingRef<Queue<Body>>);
5
+ get queue(): Queue<Body>;
19
6
  }
20
- export {};
@@ -19,15 +19,9 @@ export class QueueService {
19
19
  constructor(ref){
20
20
  this.ref = ref;
21
21
  }
22
- /** Access the raw Queue binding directly. */ get queue() {
22
+ get queue() {
23
23
  return this.ref.value;
24
24
  }
25
- send(message, options) {
26
- return this.queue.send(message, options);
27
- }
28
- sendBatch(messages, options) {
29
- return this.queue.sendBatch(messages, options);
30
- }
31
25
  }
32
26
  QueueService = _ts_decorate([
33
27
  Injectable(),