From 4f2c0c61ad69e0ac248a5a59c96ff46b017d2342 Mon Sep 17 00:00:00 2001
From: Tim Holm
Date: Fri, 5 May 2023 12:15:15 +1000
Subject: [PATCH 01/26] export MethodOptions
---
src/resources/api.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/resources/api.ts b/src/resources/api.ts
index 167f022a..93d48124 100644
--- a/src/resources/api.ts
+++ b/src/resources/api.ts
@@ -50,7 +50,7 @@ export class ApiWorkerOptions {
}
}
-interface MethodOptions {
+export interface MethodOptions {
/**
* Optional security definitions for this method
*/
From c5fb89ee4aff64a996e728ef02f367079d0e6883 Mon Sep 17 00:00:00 2001
From: Tim Holm
Date: Fri, 5 May 2023 12:24:47 +1000
Subject: [PATCH 02/26] export ApiOpts.
---
src/resources/api.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/resources/api.ts b/src/resources/api.ts
index 93d48124..29af22db 100644
--- a/src/resources/api.ts
+++ b/src/resources/api.ts
@@ -230,7 +230,7 @@ interface JwtSecurityDefinition extends BaseSecurityDefinition<'jwt'> {
// TODO: Union type for multiple security definition mappings
type SecurityDefinition = JwtSecurityDefinition;
-interface ApiOpts {
+export interface ApiOpts {
/**
* The base path for all routes in the API.
*
From 250c9d90ee2f869e884b61d847ef8b69c34c4235 Mon Sep 17 00:00:00 2001
From: Tim Holm
Date: Fri, 5 May 2023 12:26:46 +1000
Subject: [PATCH 03/26] Add Addition ApiOption exports.
---
src/resources/api.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/resources/api.ts b/src/resources/api.ts
index 29af22db..210d8d9e 100644
--- a/src/resources/api.ts
+++ b/src/resources/api.ts
@@ -218,17 +218,17 @@ export class Route {
}
}
-interface BaseSecurityDefinition {
+export interface BaseSecurityDefinition {
kind: T;
}
-interface JwtSecurityDefinition extends BaseSecurityDefinition<'jwt'> {
+export interface JwtSecurityDefinition extends BaseSecurityDefinition<'jwt'> {
issuer: string;
audiences: string[];
}
// TODO: Union type for multiple security definition mappings
-type SecurityDefinition = JwtSecurityDefinition;
+export type SecurityDefinition = JwtSecurityDefinition;
export interface ApiOpts {
/**
From 89e6437f3239355d9293caa377d677e4d01d4234 Mon Sep 17 00:00:00 2001
From: Jye Cusch
Date: Mon, 8 May 2023 12:24:00 +1000
Subject: [PATCH 04/26] fix: return undefined from json() if no body is present
in ctx
---
src/faas/v0/context.ts | 13 ++++++++++++-
src/resources/api.ts | 1 -
src/resources/queue.ts | 1 -
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/faas/v0/context.ts b/src/faas/v0/context.ts
index aa716e28..1ce96227 100644
--- a/src/faas/v0/context.ts
+++ b/src/faas/v0/context.ts
@@ -102,6 +102,12 @@ export abstract class AbstractRequest<
this.traceContext = traceContext;
}
+ /**
+ * Return the request payload as a string.
+ * If the request was a byte array it will converted using UTF-8 text decoding.
+ *
+ * @returns the request payload as a string
+ */
text(): string {
const stringPayload =
typeof this.data === 'string'
@@ -111,9 +117,14 @@ export abstract class AbstractRequest<
return stringPayload;
}
+ /**
+ * Deserialize the request payload from JSON
+ *
+ * @returns JSON parsed request body
+ */
json(): JSONT {
// attempt to deserialize as a JSON object
- return this.text() ? JSON.parse(this.text()) : {};
+ return textBody ? JSON.parse(textBody) : undefined;
}
}
diff --git a/src/resources/api.ts b/src/resources/api.ts
index 167f022a..26403403 100644
--- a/src/resources/api.ts
+++ b/src/resources/api.ts
@@ -20,7 +20,6 @@ import {
Resource,
ResourceDeclareRequest,
ResourceDeclareResponse,
- ResourceDetailsRequest,
ResourceDetailsResponse,
ResourceType,
ResourceTypeMap,
diff --git a/src/resources/queue.ts b/src/resources/queue.ts
index 03f7bb99..393a93c5 100644
--- a/src/resources/queue.ts
+++ b/src/resources/queue.ts
@@ -16,7 +16,6 @@ import {
ResourceDeclareRequest,
ResourceType,
Action,
- ActionMap,
ResourceDeclareResponse,
} from '@nitric/api/proto/resource/v1/resource_pb';
import resourceClient from './client';
From fc64dcb6ce98260f8d96c1f80422b4fd2726b9ca Mon Sep 17 00:00:00 2001
From: Tim Holm
Date: Tue, 9 May 2023 10:21:46 +1000
Subject: [PATCH 05/26] prettier & fixes
---
README.md | 11 +++++------
assets/nitric-logo.svg | 19 ++++++++-----------
src/faas/v0/context.ts | 3 ++-
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index f19ee39e..3e1f3be2 100644
--- a/README.md
+++ b/README.md
@@ -5,21 +5,20 @@
- Build nitric applications with Node.js
+ Build Nitric applications with Node.js
-
-
+
-
+
-
+
-
+
The NodeJS SDK supports the use of the Nitric framework with NodeJS 12+. For more information, check out the main [Nitric repo](https://github.com/nitrictech/nitric).
diff --git a/assets/nitric-logo.svg b/assets/nitric-logo.svg
index 2409c1b7..f25ad168 100644
--- a/assets/nitric-logo.svg
+++ b/assets/nitric-logo.svg
@@ -1,14 +1,11 @@
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
diff --git a/src/faas/v0/context.ts b/src/faas/v0/context.ts
index 1ce96227..001d3592 100644
--- a/src/faas/v0/context.ts
+++ b/src/faas/v0/context.ts
@@ -119,11 +119,12 @@ export abstract class AbstractRequest<
/**
* Deserialize the request payload from JSON
- *
+ *
* @returns JSON parsed request body
*/
json(): JSONT {
// attempt to deserialize as a JSON object
+ const textBody = this.text();
return textBody ? JSON.parse(textBody) : undefined;
}
}
From 646ba583f038f878d7d81d8e6037c35dfd37fc99 Mon Sep 17 00:00:00 2001
From: Jye Cusch
Date: Tue, 9 May 2023 10:24:42 +1000
Subject: [PATCH 06/26] fix: rename 'opts' to 'options' for clarity
---
src/resources/api.ts | 126 +++++++++++++++++++++----------------------
1 file changed, 63 insertions(+), 63 deletions(-)
diff --git a/src/resources/api.ts b/src/resources/api.ts
index 210d8d9e..77ddce85 100644
--- a/src/resources/api.ts
+++ b/src/resources/api.ts
@@ -20,7 +20,6 @@ import {
Resource,
ResourceDeclareRequest,
ResourceDeclareResponse,
- ResourceDetailsRequest,
ResourceDetailsResponse,
ResourceType,
ResourceTypeMap,
@@ -28,7 +27,7 @@ import {
import { fromGrpcError } from '../api/errors';
import resourceClient from './client';
import { HttpMethod } from '../types';
-import { make, newer, Resource as Base } from './common';
+import { make, Resource as Base } from './common';
import path from 'path';
export class ApiWorkerOptions {
@@ -81,7 +80,7 @@ class Method {
}
}
-interface RouteOpts {
+export interface RouteOptions {
/**
* Optional middleware to apply to all methods for the route. Useful for universal middleware such as CORS or Auth.
*/
@@ -93,22 +92,26 @@ export class Route {
public readonly path: string;
public readonly middleware: HttpMiddleware[];
- constructor(api: Api, path: string, opts: RouteOpts = {}) {
+ constructor(
+ api: Api,
+ path: string,
+ options: RouteOptions = {}
+ ) {
this.api = api;
this.path = path;
- const { middleware = [] } = opts;
+ const { middleware = [] } = options;
this.middleware = composeMiddleware(middleware);
}
async method(
methods: HttpMethod[],
- opts: MethodOptions,
+ options: MethodOptions,
...middleware: HttpMiddleware[]
): Promise {
const getHandler = new Method(
this,
methods,
- opts,
+ options,
...this.middleware,
...middleware
);
@@ -119,100 +122,100 @@ export class Route {
* Register a handler function for GET requests to this route
*
* @param middleware that should be run on any GET request to this route
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async get(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.method(['GET'], opts, ...composeMiddleware(middleware));
+ return this.method(['GET'], options, ...composeMiddleware(middleware));
}
/**
* Register a handler function for POST requests to this route
*
* @param middleware that should respond to any matching requests to this route and method
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async post(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.method(['POST'], opts, ...composeMiddleware(middleware));
+ return this.method(['POST'], options, ...composeMiddleware(middleware));
}
/**
* Register a handler function for PUT requests to this route
*
* @param middleware that should respond to any matching requests to this route and method
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async put(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.method(['PUT'], opts, ...composeMiddleware(middleware));
+ return this.method(['PUT'], options, ...composeMiddleware(middleware));
}
/**
* Register a handler function for PATCH requests to this route
*
* @param middleware that should respond to any matching requests to this route and method
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async patch(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.method(['PATCH'], opts, ...composeMiddleware(middleware));
+ return this.method(['PATCH'], options, ...composeMiddleware(middleware));
}
/**
* Register a handler function for DELETE requests to this route
*
* @param middleware that should respond to any matching requests to this route and method
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async delete(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.method(['DELETE'], opts, ...composeMiddleware(middleware));
+ return this.method(['DELETE'], options, ...composeMiddleware(middleware));
}
/**
* Register a handler function for OPTIONS requests to this route
*
* @param middleware that should respond to any matching requests to this route and method
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async options(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.method(['OPTIONS'], opts, ...composeMiddleware(middleware));
+ return this.method(['OPTIONS'], options, ...composeMiddleware(middleware));
}
/**
* Register a handler function for GET, POST, PATCH, PUT and DELETE requests to this route
*
* @param middleware that should respond to matching requests to this route and all HTTP methods
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns a Promise that resolves if the handler stops running
*/
async all(
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
return this.method(
['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'],
- opts,
+ options,
...composeMiddleware(middleware)
);
}
@@ -230,7 +233,7 @@ export interface JwtSecurityDefinition extends BaseSecurityDefinition<'jwt'> {
// TODO: Union type for multiple security definition mappings
export type SecurityDefinition = JwtSecurityDefinition;
-export interface ApiOpts {
+export interface ApiOptions {
/**
* The base path for all routes in the API.
*
@@ -249,7 +252,7 @@ export interface ApiOpts {
securityDefinitions?: Record;
/**
- * Optional root level secruity for the API
+ * Optional root level security for the API
*/
security?: Record;
}
@@ -274,7 +277,7 @@ export class Api extends Base {
>;
private readonly security?: Record;
- constructor(name: string, options: ApiOpts = {}) {
+ constructor(name: string, options: ApiOptions = {}) {
super(name);
const {
middleware,
@@ -307,7 +310,7 @@ export class Api extends Base {
* @param options route options such as setting middleware which applies to all methods in the route
* @returns the route object, which can be used to register method handlers
*/
- route(match: string, options?: RouteOpts): Route {
+ route(match: string, options?: RouteOptions): Route {
// ensure path seperator is always foward slash (for windows)
const apiRoute = path.join(this.path, match).split(path.sep).join('/');
@@ -337,15 +340,15 @@ export class Api extends Base {
*
* @param match the route path matcher e.g. '/home'. Supports path params via colon prefix e.g. '/customers/:customerId'
* @param middleware the middleware/handler to register for calls to GET
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns A Promise that resolves when the handler terminates.
*/
async get(
match: string,
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.route(match).get(composeMiddleware(middleware), opts);
+ return this.route(match).get(composeMiddleware(middleware), options);
}
/**
@@ -353,15 +356,15 @@ export class Api extends Base {
*
* @param match the route path matcher e.g. '/home'. Supports path params via colon prefix e.g. '/customers/:customerId'
* @param middleware the middleware/handler to register for calls to POST
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns A Promise that resolves when the handler terminates.
*/
async post(
match: string,
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.route(match).post(composeMiddleware(middleware), opts);
+ return this.route(match).post(composeMiddleware(middleware), options);
}
/**
@@ -369,15 +372,15 @@ export class Api extends Base {
*
* @param match the route path matcher e.g. '/home'. Supports path params via colon prefix e.g. '/customers/:customerId'
* @param middleware the middleware/handler to register for calls to PUT
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns A Promise that resolves when the handler terminates.
*/
async put(
match: string,
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.route(match).put(composeMiddleware(middleware), opts);
+ return this.route(match).put(composeMiddleware(middleware), options);
}
/**
@@ -385,15 +388,15 @@ export class Api extends Base {
*
* @param match the route path matcher e.g. '/home'. Supports path params via colon prefix e.g. '/customers/:customerId'
* @param middleware the middleware/handler to register for calls to PATCH
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns A Promise that resolves when the handler terminates.
*/
async patch(
match: string,
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.route(match).patch(composeMiddleware(middleware), opts);
+ return this.route(match).patch(composeMiddleware(middleware), options);
}
/**
@@ -401,15 +404,15 @@ export class Api extends Base {
*
* @param match the route path matcher e.g. '/home'. Supports path params via colon prefix e.g. '/customers/:customerId'
* @param middleware the middleware/handler to register for calls to DELETE
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns A Promise that resolves when the handler terminates.
*/
async delete(
match: string,
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.route(match).delete(composeMiddleware(middleware), opts);
+ return this.route(match).delete(composeMiddleware(middleware), options);
}
/**
@@ -417,15 +420,15 @@ export class Api extends Base {
*
* @param match the route path matcher e.g. '/home'. Supports path params via colon prefix e.g. '/customers/:customerId'
* @param middleware the middleware/handler to register for calls to DELETE
- * @param opts the options for this method, such as security definitions
+ * @param options for this method, such as security definitions
* @returns A Promise that resolves when the handler terminates.
*/
async options(
match: string,
middleware: HttpMiddleware | HttpMiddleware[],
- opts: MethodOptions = {}
+ options: MethodOptions = {}
): Promise {
- return this.route(match).options(composeMiddleware(middleware), opts);
+ return this.route(match).options(composeMiddleware(middleware), options);
}
/**
@@ -498,16 +501,13 @@ export class Api extends Base {
req.setResource(resource);
return new Promise((resolve, reject) => {
- resourceClient.declare(
- req,
- (error, response: ResourceDeclareResponse) => {
- if (error) {
- reject(fromGrpcError(error));
- } else {
- resolve(resource);
- }
+ resourceClient.declare(req, (error, _: ResourceDeclareResponse) => {
+ if (error) {
+ reject(fromGrpcError(error));
+ } else {
+ resolve(resource);
}
- );
+ });
});
}
}
@@ -524,19 +524,19 @@ export class Api extends Base {
*/
export const api: (
name: string,
- options?: ApiOpts
+ options?: ApiOptions
) => Api = make(Api);
/**
* Create a JWT security definition.
*
- * @param opts security definition options
+ * @param options security definition options
* @returns the new security definition.
*/
export const jwt = (
- opts: Omit
+ options: Omit
): JwtSecurityDefinition => {
- return { kind: 'jwt', issuer: opts.issuer, audiences: opts.audiences };
+ return { kind: 'jwt', issuer: options.issuer, audiences: options.audiences };
};
const composeMiddleware = (middleware: HttpMiddleware | HttpMiddleware[]) =>
From bc8b15114e7342762a26226ae899e6e115f71bb0 Mon Sep 17 00:00:00 2001
From: Ryan Cartwright
Date: Thu, 20 Apr 2023 09:37:54 +1000
Subject: [PATCH 07/26] add bucket notification
---
.gitignore | 2 +-
lib/index.d.ts | 3327 +++
lib/index.js | 20218 ++++++++++++++++++
package.json | 1 +
src/api/storage/v0/storage.ts | 2 +-
src/faas/v0/context.test.ts | 2 +-
src/faas/v0/context.ts | 131 +-
src/faas/v0/handler.ts | 9 +-
src/faas/v0/start.ts | 65 +-
src/gen/proto/deploy/v1/deploy_grpc_pb.d.ts | 27 +
src/gen/proto/deploy/v1/deploy_grpc_pb.js | 87 +
src/gen/proto/deploy/v1/deploy_pb.d.ts | 691 +
src/gen/proto/deploy/v1/deploy_pb.js | 5194 +++++
src/gen/proto/faas/v1/faas_pb.d.ts | 132 +
src/gen/proto/faas/v1/faas_pb.js | 1370 +-
src/gen/proto/resource/v1/resource_pb.d.ts | 1 +
src/gen/proto/resource/v1/resource_pb.js | 3 +-
src/resources/bucket.ts | 56 +
18 files changed, 31079 insertions(+), 239 deletions(-)
create mode 100644 lib/index.d.ts
create mode 100644 lib/index.js
create mode 100644 src/gen/proto/deploy/v1/deploy_grpc_pb.d.ts
create mode 100644 src/gen/proto/deploy/v1/deploy_grpc_pb.js
create mode 100644 src/gen/proto/deploy/v1/deploy_pb.d.ts
create mode 100644 src/gen/proto/deploy/v1/deploy_pb.js
diff --git a/.gitignore b/.gitignore
index 7866e5c5..f45e4d64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -90,6 +90,6 @@ typings/
# DynamoDB Local files
.dynamodb/
-lib/
+# lib/
contracts/
\ No newline at end of file
diff --git a/lib/index.d.ts b/lib/index.d.ts
new file mode 100644
index 00000000..31c2d1db
--- /dev/null
+++ b/lib/index.d.ts
@@ -0,0 +1,3327 @@
+import * as jspb from 'google-protobuf';
+import * as google_protobuf_struct_pb from 'google-protobuf/google/protobuf/struct_pb';
+import * as grpc from '@grpc/grpc-js';
+import * as api$1 from '@opentelemetry/api';
+
+// package: nitric.event.v1
+
+
+declare class EventPublishRequest extends jspb.Message {
+ getTopic(): string;
+ setTopic(value: string): void;
+
+ hasEvent(): boolean;
+ clearEvent(): void;
+ getEvent(): NitricEvent$1 | undefined;
+ setEvent(value?: NitricEvent$1): void;
+
+ getDelay(): number;
+ setDelay(value: number): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): EventPublishRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: EventPublishRequest): EventPublishRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: EventPublishRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): EventPublishRequest;
+ static deserializeBinaryFromReader(message: EventPublishRequest, reader: jspb.BinaryReader): EventPublishRequest;
+}
+
+declare namespace EventPublishRequest {
+ export type AsObject = {
+ topic: string,
+ event?: NitricEvent$1.AsObject,
+ delay: number,
+ }
+}
+
+declare class EventPublishResponse extends jspb.Message {
+ getId(): string;
+ setId(value: string): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): EventPublishResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: EventPublishResponse): EventPublishResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: EventPublishResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): EventPublishResponse;
+ static deserializeBinaryFromReader(message: EventPublishResponse, reader: jspb.BinaryReader): EventPublishResponse;
+}
+
+declare namespace EventPublishResponse {
+ export type AsObject = {
+ id: string,
+ }
+}
+
+declare class TopicListRequest extends jspb.Message {
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): TopicListRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: TopicListRequest): TopicListRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: TopicListRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): TopicListRequest;
+ static deserializeBinaryFromReader(message: TopicListRequest, reader: jspb.BinaryReader): TopicListRequest;
+}
+
+declare namespace TopicListRequest {
+ export type AsObject = {
+ }
+}
+
+declare class TopicListResponse extends jspb.Message {
+ clearTopicsList(): void;
+ getTopicsList(): Array;
+ setTopicsList(value: Array): void;
+ addTopics(value?: NitricTopic, index?: number): NitricTopic;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): TopicListResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: TopicListResponse): TopicListResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: TopicListResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): TopicListResponse;
+ static deserializeBinaryFromReader(message: TopicListResponse, reader: jspb.BinaryReader): TopicListResponse;
+}
+
+declare namespace TopicListResponse {
+ export type AsObject = {
+ topicsList: Array,
+ }
+}
+
+declare class NitricTopic extends jspb.Message {
+ getName(): string;
+ setName(value: string): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): NitricTopic.AsObject;
+ static toObject(includeInstance: boolean, msg: NitricTopic): NitricTopic.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: NitricTopic, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): NitricTopic;
+ static deserializeBinaryFromReader(message: NitricTopic, reader: jspb.BinaryReader): NitricTopic;
+}
+
+declare namespace NitricTopic {
+ export type AsObject = {
+ name: string,
+ }
+}
+
+declare class NitricEvent$1 extends jspb.Message {
+ getId(): string;
+ setId(value: string): void;
+
+ getPayloadType(): string;
+ setPayloadType(value: string): void;
+
+ hasPayload(): boolean;
+ clearPayload(): void;
+ getPayload(): google_protobuf_struct_pb.Struct | undefined;
+ setPayload(value?: google_protobuf_struct_pb.Struct): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): NitricEvent$1.AsObject;
+ static toObject(includeInstance: boolean, msg: NitricEvent$1): NitricEvent$1.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: NitricEvent$1, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): NitricEvent$1;
+ static deserializeBinaryFromReader(message: NitricEvent$1, reader: jspb.BinaryReader): NitricEvent$1;
+}
+
+declare namespace NitricEvent$1 {
+ export type AsObject = {
+ id: string,
+ payloadType: string,
+ payload?: google_protobuf_struct_pb.Struct.AsObject,
+ }
+}
+
+// GENERATED CODE -- DO NOT EDIT!
+
+
+declare class EventServiceClient extends grpc.Client {
+ constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
+ publish(argument: EventPublishRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ publish(argument: EventPublishRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ publish(argument: EventPublishRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+}
+
+declare class TopicServiceClient extends grpc.Client {
+ constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
+ list(argument: TopicListRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ list(argument: TopicListRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ list(argument: TopicListRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+}
+
+interface NitricEvent {
+ /**
+ * Uniquely identifies the event.
+ *
+ * Within your app you must ensure the ID is unique.
+ * Subscribers can assume events with the same ID are duplicates and avoid reprocessing them
+ */
+ id?: string;
+ /**
+ * An optional description of the event type.
+ *
+ * Can be useful for de-serialization, routing or observability. The format of this value is determined by the producer.
+ */
+ payloadType?: string;
+ /**
+ * The event's payload data, with details of the event.
+ */
+ payload: Record;
+}
+interface Task {
+ /**
+ * Uniquely identifies the task.
+ *
+ * Within your app you must ensure the ID is unique.
+ */
+ id?: string;
+ /**
+ * The ID for the current lease of this task.
+ *
+ * A task may be leased multiple times, resulting in new lease IDs.
+ */
+ leaseId?: string;
+ /**
+ * An optional description of the task type.
+ *
+ * Can be useful for de-serialization, routing or observability. The format of this value is determined by the producer.
+ */
+ payloadType?: string;
+ /**
+ * The task's payload data, with details of the task or work to be done.
+ */
+ payload?: Record;
+}
+type WhereQueryOperator = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'startsWith';
+type WhereValueExpression = string | number | boolean;
+type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'OPTIONS';
+
+interface PublishOptions {
+ /** Number of seconds to delay message publishing by */
+ delay?: number;
+}
+declare class Topic {
+ eventing: Eventing;
+ name: string;
+ constructor(eventing: Eventing, name: string);
+ /**
+ * Publishes an event to a nitric topic.
+ *
+ * @param event The event to publish
+ * @param opts Additional publishing options
+ * @returns NitricEvent containing the unique id of the event (if not provided it will be generated)
+ *
+ * @example
+ * ```typescript
+ * import { Eventing } from "@nitric/sdk";
+ *
+ * const eventing = Eventing();
+ *
+ * async function publishEvent(): NitricEvent {
+ * const topic = eventing.topic("my-topic");
+ * const event = {
+ * payloadType: "my-payload",
+ * payload: {
+ * value: "Hello World!"
+ * }
+ * };
+ * // Publish immediately
+ * await topic.publish(event);
+ *
+ * // Publish after 10 seconds delay
+ * await topic.publish(event, { delay: 10 });
+ * }
+ * ```
+ */
+ publish(event: NitricEvent, opts?: PublishOptions): Promise;
+}
+/**
+ * Eventing object encapsulating the Nitric gRPC clients for Event and Topic services.
+ *
+ * Used to created references to Topics and perform Event publishing operations.
+ *
+ * @example
+ * ```typescript
+ * import { Eventing } from "@nitric/sdk";
+ * const eventing = new Eventing();
+ * const topic = eventing.topic('notifications');
+ * ```
+ */
+declare class Eventing {
+ private _clients;
+ get EventServiceClient(): EventServiceClient;
+ get TopicServiceClient(): TopicServiceClient;
+ /**
+ * Get a reference to a Topic.
+ *
+ * @param name Name of the topic, as defined in nitric.yaml.
+ * @returns a topic resource.
+ * @example
+ * ```typescript
+ * import { Eventing } from "@nitric/sdk";
+ * const eventing = new Eventing();
+ * const topic = eventing.topic('notifications');
+ * ```
+ */
+ topic(name: string): Topic;
+ /**
+ * Retrieve all available topic references by querying for available topics.
+ *
+ * @returns A promise containing the list of available nitric topics
+ * @example
+ * ```typescript
+ * import { Eventing } from "@nitric/sdk";
+ *
+ * const eventing = new Eventing();
+ *
+ * const topics = await eventing.topics();
+ * ```
+ */
+ topics(): Promise;
+}
+/**
+ * Events API client.
+ *
+ * @returns an Events API client.
+ * @example
+ * ```typescript
+ * import { events } from "@nitric/sdk";
+ *
+ * async function publishEvent() {
+ * const topic = events().topic('notifications');
+ *
+ * await topic.publish({
+ * payload: {
+ * amazing: 'thing happened!',
+ * },
+ * });
+ *
+ * return 'Successfully published notification';
+ * }
+ * ```
+ */
+declare const events: () => Eventing;
+
+// package: nitric.document.v1
+
+
+declare class Collection extends jspb.Message {
+ getName(): string;
+ setName(value: string): void;
+
+ hasParent(): boolean;
+ clearParent(): void;
+ getParent(): Key | undefined;
+ setParent(value?: Key): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): Collection.AsObject;
+ static toObject(includeInstance: boolean, msg: Collection): Collection.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: Collection, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): Collection;
+ static deserializeBinaryFromReader(message: Collection, reader: jspb.BinaryReader): Collection;
+}
+
+declare namespace Collection {
+ export type AsObject = {
+ name: string,
+ parent?: Key.AsObject,
+ }
+}
+
+declare class Key extends jspb.Message {
+ hasCollection(): boolean;
+ clearCollection(): void;
+ getCollection(): Collection | undefined;
+ setCollection(value?: Collection): void;
+
+ getId(): string;
+ setId(value: string): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): Key.AsObject;
+ static toObject(includeInstance: boolean, msg: Key): Key.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: Key, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): Key;
+ static deserializeBinaryFromReader(message: Key, reader: jspb.BinaryReader): Key;
+}
+
+declare namespace Key {
+ export type AsObject = {
+ collection?: Collection.AsObject,
+ id: string,
+ }
+}
+
+declare class Document extends jspb.Message {
+ hasContent(): boolean;
+ clearContent(): void;
+ getContent(): google_protobuf_struct_pb.Struct | undefined;
+ setContent(value?: google_protobuf_struct_pb.Struct): void;
+
+ hasKey(): boolean;
+ clearKey(): void;
+ getKey(): Key | undefined;
+ setKey(value?: Key): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): Document.AsObject;
+ static toObject(includeInstance: boolean, msg: Document): Document.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: Document, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): Document;
+ static deserializeBinaryFromReader(message: Document, reader: jspb.BinaryReader): Document;
+}
+
+declare namespace Document {
+ export type AsObject = {
+ content?: google_protobuf_struct_pb.Struct.AsObject,
+ key?: Key.AsObject,
+ }
+}
+
+declare class ExpressionValue extends jspb.Message {
+ hasIntValue(): boolean;
+ clearIntValue(): void;
+ getIntValue(): number;
+ setIntValue(value: number): void;
+
+ hasDoubleValue(): boolean;
+ clearDoubleValue(): void;
+ getDoubleValue(): number;
+ setDoubleValue(value: number): void;
+
+ hasStringValue(): boolean;
+ clearStringValue(): void;
+ getStringValue(): string;
+ setStringValue(value: string): void;
+
+ hasBoolValue(): boolean;
+ clearBoolValue(): void;
+ getBoolValue(): boolean;
+ setBoolValue(value: boolean): void;
+
+ getKindCase(): ExpressionValue.KindCase;
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): ExpressionValue.AsObject;
+ static toObject(includeInstance: boolean, msg: ExpressionValue): ExpressionValue.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: ExpressionValue, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): ExpressionValue;
+ static deserializeBinaryFromReader(message: ExpressionValue, reader: jspb.BinaryReader): ExpressionValue;
+}
+
+declare namespace ExpressionValue {
+ export type AsObject = {
+ intValue: number,
+ doubleValue: number,
+ stringValue: string,
+ boolValue: boolean,
+ }
+
+ export enum KindCase {
+ KIND_NOT_SET = 0,
+ INT_VALUE = 1,
+ DOUBLE_VALUE = 2,
+ STRING_VALUE = 3,
+ BOOL_VALUE = 4,
+ }
+}
+
+declare class Expression extends jspb.Message {
+ getOperand(): string;
+ setOperand(value: string): void;
+
+ getOperator(): string;
+ setOperator(value: string): void;
+
+ hasValue(): boolean;
+ clearValue(): void;
+ getValue(): ExpressionValue | undefined;
+ setValue(value?: ExpressionValue): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): Expression.AsObject;
+ static toObject(includeInstance: boolean, msg: Expression): Expression.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: Expression, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): Expression;
+ static deserializeBinaryFromReader(message: Expression, reader: jspb.BinaryReader): Expression;
+}
+
+declare namespace Expression {
+ export type AsObject = {
+ operand: string,
+ operator: string,
+ value?: ExpressionValue.AsObject,
+ }
+}
+
+declare class DocumentGetRequest extends jspb.Message {
+ hasKey(): boolean;
+ clearKey(): void;
+ getKey(): Key | undefined;
+ setKey(value?: Key): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentGetRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentGetRequest): DocumentGetRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentGetRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentGetRequest;
+ static deserializeBinaryFromReader(message: DocumentGetRequest, reader: jspb.BinaryReader): DocumentGetRequest;
+}
+
+declare namespace DocumentGetRequest {
+ export type AsObject = {
+ key?: Key.AsObject,
+ }
+}
+
+declare class DocumentGetResponse extends jspb.Message {
+ hasDocument(): boolean;
+ clearDocument(): void;
+ getDocument(): Document | undefined;
+ setDocument(value?: Document): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentGetResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentGetResponse): DocumentGetResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentGetResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentGetResponse;
+ static deserializeBinaryFromReader(message: DocumentGetResponse, reader: jspb.BinaryReader): DocumentGetResponse;
+}
+
+declare namespace DocumentGetResponse {
+ export type AsObject = {
+ document?: Document.AsObject,
+ }
+}
+
+declare class DocumentSetRequest extends jspb.Message {
+ hasKey(): boolean;
+ clearKey(): void;
+ getKey(): Key | undefined;
+ setKey(value?: Key): void;
+
+ hasContent(): boolean;
+ clearContent(): void;
+ getContent(): google_protobuf_struct_pb.Struct | undefined;
+ setContent(value?: google_protobuf_struct_pb.Struct): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentSetRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentSetRequest): DocumentSetRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentSetRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentSetRequest;
+ static deserializeBinaryFromReader(message: DocumentSetRequest, reader: jspb.BinaryReader): DocumentSetRequest;
+}
+
+declare namespace DocumentSetRequest {
+ export type AsObject = {
+ key?: Key.AsObject,
+ content?: google_protobuf_struct_pb.Struct.AsObject,
+ }
+}
+
+declare class DocumentSetResponse extends jspb.Message {
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentSetResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentSetResponse): DocumentSetResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentSetResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentSetResponse;
+ static deserializeBinaryFromReader(message: DocumentSetResponse, reader: jspb.BinaryReader): DocumentSetResponse;
+}
+
+declare namespace DocumentSetResponse {
+ export type AsObject = {
+ }
+}
+
+declare class DocumentDeleteRequest extends jspb.Message {
+ hasKey(): boolean;
+ clearKey(): void;
+ getKey(): Key | undefined;
+ setKey(value?: Key): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentDeleteRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentDeleteRequest): DocumentDeleteRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentDeleteRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentDeleteRequest;
+ static deserializeBinaryFromReader(message: DocumentDeleteRequest, reader: jspb.BinaryReader): DocumentDeleteRequest;
+}
+
+declare namespace DocumentDeleteRequest {
+ export type AsObject = {
+ key?: Key.AsObject,
+ }
+}
+
+declare class DocumentDeleteResponse extends jspb.Message {
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentDeleteResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentDeleteResponse): DocumentDeleteResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentDeleteResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentDeleteResponse;
+ static deserializeBinaryFromReader(message: DocumentDeleteResponse, reader: jspb.BinaryReader): DocumentDeleteResponse;
+}
+
+declare namespace DocumentDeleteResponse {
+ export type AsObject = {
+ }
+}
+
+declare class DocumentQueryRequest extends jspb.Message {
+ hasCollection(): boolean;
+ clearCollection(): void;
+ getCollection(): Collection | undefined;
+ setCollection(value?: Collection): void;
+
+ clearExpressionsList(): void;
+ getExpressionsList(): Array;
+ setExpressionsList(value: Array): void;
+ addExpressions(value?: Expression, index?: number): Expression;
+
+ getLimit(): number;
+ setLimit(value: number): void;
+
+ getPagingTokenMap(): jspb.Map;
+ clearPagingTokenMap(): void;
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentQueryRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentQueryRequest): DocumentQueryRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentQueryRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentQueryRequest;
+ static deserializeBinaryFromReader(message: DocumentQueryRequest, reader: jspb.BinaryReader): DocumentQueryRequest;
+}
+
+declare namespace DocumentQueryRequest {
+ export type AsObject = {
+ collection?: Collection.AsObject,
+ expressionsList: Array,
+ limit: number,
+ pagingTokenMap: Array<[string, string]>,
+ }
+}
+
+declare class DocumentQueryResponse extends jspb.Message {
+ clearDocumentsList(): void;
+ getDocumentsList(): Array;
+ setDocumentsList(value: Array): void;
+ addDocuments(value?: Document, index?: number): Document;
+
+ getPagingTokenMap(): jspb.Map;
+ clearPagingTokenMap(): void;
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentQueryResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentQueryResponse): DocumentQueryResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentQueryResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentQueryResponse;
+ static deserializeBinaryFromReader(message: DocumentQueryResponse, reader: jspb.BinaryReader): DocumentQueryResponse;
+}
+
+declare namespace DocumentQueryResponse {
+ export type AsObject = {
+ documentsList: Array,
+ pagingTokenMap: Array<[string, string]>,
+ }
+}
+
+declare class DocumentQueryStreamRequest extends jspb.Message {
+ hasCollection(): boolean;
+ clearCollection(): void;
+ getCollection(): Collection | undefined;
+ setCollection(value?: Collection): void;
+
+ clearExpressionsList(): void;
+ getExpressionsList(): Array;
+ setExpressionsList(value: Array): void;
+ addExpressions(value?: Expression, index?: number): Expression;
+
+ getLimit(): number;
+ setLimit(value: number): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentQueryStreamRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentQueryStreamRequest): DocumentQueryStreamRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentQueryStreamRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentQueryStreamRequest;
+ static deserializeBinaryFromReader(message: DocumentQueryStreamRequest, reader: jspb.BinaryReader): DocumentQueryStreamRequest;
+}
+
+declare namespace DocumentQueryStreamRequest {
+ export type AsObject = {
+ collection?: Collection.AsObject,
+ expressionsList: Array,
+ limit: number,
+ }
+}
+
+declare class DocumentQueryStreamResponse extends jspb.Message {
+ hasDocument(): boolean;
+ clearDocument(): void;
+ getDocument(): Document | undefined;
+ setDocument(value?: Document): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): DocumentQueryStreamResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: DocumentQueryStreamResponse): DocumentQueryStreamResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: DocumentQueryStreamResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): DocumentQueryStreamResponse;
+ static deserializeBinaryFromReader(message: DocumentQueryStreamResponse, reader: jspb.BinaryReader): DocumentQueryStreamResponse;
+}
+
+declare namespace DocumentQueryStreamResponse {
+ export type AsObject = {
+ document?: Document.AsObject,
+ }
+}
+
+// GENERATED CODE -- DO NOT EDIT!
+
+
+declare class DocumentServiceClient extends grpc.Client {
+ constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
+ get(argument: DocumentGetRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ get(argument: DocumentGetRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ get(argument: DocumentGetRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ set(argument: DocumentSetRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ set(argument: DocumentSetRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ set(argument: DocumentSetRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ delete(argument: DocumentDeleteRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ delete(argument: DocumentDeleteRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ delete(argument: DocumentDeleteRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ query(argument: DocumentQueryRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ query(argument: DocumentQueryRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ query(argument: DocumentQueryRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ queryStream(argument: DocumentQueryStreamRequest, metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientReadableStream;
+ queryStream(argument: DocumentQueryStreamRequest, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream;
+}
+
+type DocumentStructure = Record;
+/**
+ * Document Ref.
+ *
+ * Provides a Document Reference class.
+ * Used to create references to collections.
+ */
+declare class DocumentRef {
+ private documentClient;
+ readonly parent: CollectionRef;
+ readonly id: string;
+ constructor(documentClient: DocumentServiceClient, parent: CollectionRef, id: string);
+ /**
+ * Return the collection document reference value.
+ *
+ * @returns the collection document reference value, or null if not found
+ */
+ get(): Promise;
+ /**
+ * Set the document content for this document reference in the database. If the
+ * document does not exist an new item will be created, otherwise an
+ * existing document will be update with the new value.
+ *
+ * @param value content the document content to store (required)
+ */
+ set(value: T): Promise;
+ /**
+ * Delete this document reference from the database if it exists.
+ */
+ delete(): Promise;
+ private toWire;
+ private depth;
+ /**
+ * Gets a Collection instance that refers to the collection at the specified path.
+ *
+ * @param name The name of the collection (required)
+ * @returns The Collection instance
+ */
+ collection(name: string): CollectionRef;
+}
+
+declare class DocumentSnapshot {
+ readonly ref: DocumentRef;
+ readonly content: T;
+ constructor(ref: DocumentRef, content: T);
+ get id(): string;
+}
+
+type PagingToken = Map;
+interface ReadableStream extends NodeJS.ReadableStream {
+ on(event: string | symbol, listener: (...args: T[]) => void): this;
+}
+interface FetchResponse {
+ documents: DocumentSnapshot[];
+ pagingToken: Map;
+}
+/**
+ * Documents
+ *
+ * Provides a Document API client.
+ * Used to create references to collections.
+ */
+declare class Query {
+ private documentClient;
+ readonly collection: CollectionRef;
+ private expressions;
+ private pagingToken;
+ private fetchLimit;
+ constructor(documentClient: DocumentServiceClient, collection: CollectionRef);
+ /**
+ * Add a where expression to the query.
+ *
+ * @param field operand the left hand side expression operand
+ * @param operator the query expression operator
+ * @param value right hand side operand
+ * @returns the Query operation
+ */
+ where(field: string, operator: WhereQueryOperator, value: WhereValueExpression): Query;
+ /**
+ * Set the query paging continuation token.
+ *
+ * @param pagingToken used to determine where to continue paging from.
+ * @returns the Query operation
+ */
+ pagingFrom(pagingToken: PagingToken): Query;
+ /**
+ * Set the query fetch limit.
+ *
+ * @param limit the maximum number for results to return.
+ * @returns the Query operation
+ */
+ limit(limit: number): Query;
+ fetch(): Promise>;
+ protected getStreamRequest(): DocumentQueryStreamRequest;
+ /**
+ * Queries the collection and returns a readable stream.
+ *
+ * @returns all query results as a stream
+ * @example
+ * ```typescript
+ * import { documents } from "@nitric/sdk";
+ *
+ * const docs = documents();
+ *
+ * async function getDocs() {
+ * const docs = [];
+ * const stream = docs
+ * .collection('customers')
+ * .query()
+ * .where('name', '==', 'david')
+ * .stream();
+ *
+ * for await (const chunk of stream) {
+ * docs.push(chunk);
+ * }
+ *
+ * return docs;
+ * }
+ * ```
+ *
+ */
+ stream(): ReadableStream>;
+}
+
+/**
+ * CollectionGroupRef
+ *
+ * Provides a Document API CollectionGroupRef class.
+ */
+declare class CollectionGroupRef {
+ private documentClient;
+ readonly parent: CollectionGroupRef;
+ readonly name: string;
+ constructor(documentClient: DocumentServiceClient, name: string, parent?: CollectionGroupRef);
+ /**
+ * Create a CollectionGroupRef referencing a sub-collection of this collection.
+ *
+ * @param name of the sub-collection
+ * @returns a reference to the sub-collection
+ */
+ collection(name: string): CollectionGroupRef;
+ /**
+ * Create a new collection query object.
+ *
+ * @returns a new collection query object
+ */
+ query(): Query;
+ private depth;
+ private toCollectionRef;
+ /**
+ * Creates a collection group reference from a collection reference.
+ *
+ * @internal
+ * @param ref a collection reference.
+ * @param dc a document service client.
+ * @returns a collection group reference.
+ */
+ static fromCollectionRef(ref: CollectionRef, dc: DocumentServiceClient): CollectionGroupRef;
+}
+
+/**
+ * CollectionRef
+ *
+ * Provides a Document API CollectionRef class.
+ */
+declare class CollectionRef {
+ private documentClient;
+ readonly name: string;
+ readonly parent?: DocumentRef;
+ constructor(documentClient: DocumentServiceClient, name: string, parent?: DocumentRef);
+ /**
+ * Return a reference to a sub-collection within the documents of this collection.
+ *
+ * Useful when querying sub-collection documents across all/many parent documents. E.g. Querying landmarks from multiple cities.
+ *
+ * @param name the name of the collection
+ * @returns a reference to all sub-collections matching the name provided.
+ */
+ collection(name: string): CollectionGroupRef;
+ /**
+ * Return a reference to a document in the collection.
+ *
+ * @param id the unique id of the document
+ * @returns new collection document reference
+ */
+ doc(id: string): DocumentRef;
+ /**
+ * Create a new collection query object.
+ *
+ * @returns a new collection query object.
+ */
+ query(): Query;
+ private toWire;
+}
+
+/**
+ * Documents
+ *
+ * Provides a Document API client.
+ * Used to create references to collections.
+ */
+declare class Documents {
+ private documentClient;
+ constructor();
+ /**
+ * Gets a Collection instance that refers to the collection at the specified path.
+ *
+ * @param name The name of the collection (required)
+ * @returns The Collection instance
+ */
+ collection(name: string): CollectionRef;
+}
+/**
+ * Documents API client.
+ *
+ * @returns a Documents API client.
+ * @example
+ * ```typescript
+ * import { documents } from "@nitric/sdk";
+ *
+ * async function setCustomer() {
+ * const collection = documents().collection('customers');
+ *
+ * collection.doc('id').set({
+ * name: 'David',
+ * });
+ * }
+ * ```
+ */
+declare const documents: () => Documents;
+
+// package: nitric.queue.v1
+
+
+declare class QueueSendRequest extends jspb.Message {
+ getQueue(): string;
+ setQueue(value: string): void;
+
+ hasTask(): boolean;
+ clearTask(): void;
+ getTask(): NitricTask | undefined;
+ setTask(value?: NitricTask): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueSendRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueSendRequest): QueueSendRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueSendRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueSendRequest;
+ static deserializeBinaryFromReader(message: QueueSendRequest, reader: jspb.BinaryReader): QueueSendRequest;
+}
+
+declare namespace QueueSendRequest {
+ export type AsObject = {
+ queue: string,
+ task?: NitricTask.AsObject,
+ }
+}
+
+declare class QueueSendResponse extends jspb.Message {
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueSendResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueSendResponse): QueueSendResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueSendResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueSendResponse;
+ static deserializeBinaryFromReader(message: QueueSendResponse, reader: jspb.BinaryReader): QueueSendResponse;
+}
+
+declare namespace QueueSendResponse {
+ export type AsObject = {
+ }
+}
+
+declare class QueueSendBatchRequest extends jspb.Message {
+ getQueue(): string;
+ setQueue(value: string): void;
+
+ clearTasksList(): void;
+ getTasksList(): Array;
+ setTasksList(value: Array): void;
+ addTasks(value?: NitricTask, index?: number): NitricTask;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueSendBatchRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueSendBatchRequest): QueueSendBatchRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueSendBatchRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueSendBatchRequest;
+ static deserializeBinaryFromReader(message: QueueSendBatchRequest, reader: jspb.BinaryReader): QueueSendBatchRequest;
+}
+
+declare namespace QueueSendBatchRequest {
+ export type AsObject = {
+ queue: string,
+ tasksList: Array,
+ }
+}
+
+declare class QueueSendBatchResponse extends jspb.Message {
+ clearFailedtasksList(): void;
+ getFailedtasksList(): Array;
+ setFailedtasksList(value: Array): void;
+ addFailedtasks(value?: FailedTask, index?: number): FailedTask;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueSendBatchResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueSendBatchResponse): QueueSendBatchResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueSendBatchResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueSendBatchResponse;
+ static deserializeBinaryFromReader(message: QueueSendBatchResponse, reader: jspb.BinaryReader): QueueSendBatchResponse;
+}
+
+declare namespace QueueSendBatchResponse {
+ export type AsObject = {
+ failedtasksList: Array,
+ }
+}
+
+declare class QueueReceiveRequest extends jspb.Message {
+ getQueue(): string;
+ setQueue(value: string): void;
+
+ getDepth(): number;
+ setDepth(value: number): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueReceiveRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueReceiveRequest): QueueReceiveRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueReceiveRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueReceiveRequest;
+ static deserializeBinaryFromReader(message: QueueReceiveRequest, reader: jspb.BinaryReader): QueueReceiveRequest;
+}
+
+declare namespace QueueReceiveRequest {
+ export type AsObject = {
+ queue: string,
+ depth: number,
+ }
+}
+
+declare class QueueReceiveResponse extends jspb.Message {
+ clearTasksList(): void;
+ getTasksList(): Array;
+ setTasksList(value: Array): void;
+ addTasks(value?: NitricTask, index?: number): NitricTask;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueReceiveResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueReceiveResponse): QueueReceiveResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueReceiveResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueReceiveResponse;
+ static deserializeBinaryFromReader(message: QueueReceiveResponse, reader: jspb.BinaryReader): QueueReceiveResponse;
+}
+
+declare namespace QueueReceiveResponse {
+ export type AsObject = {
+ tasksList: Array,
+ }
+}
+
+declare class QueueCompleteRequest extends jspb.Message {
+ getQueue(): string;
+ setQueue(value: string): void;
+
+ getLeaseId(): string;
+ setLeaseId(value: string): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueCompleteRequest.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueCompleteRequest): QueueCompleteRequest.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueCompleteRequest, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueCompleteRequest;
+ static deserializeBinaryFromReader(message: QueueCompleteRequest, reader: jspb.BinaryReader): QueueCompleteRequest;
+}
+
+declare namespace QueueCompleteRequest {
+ export type AsObject = {
+ queue: string,
+ leaseId: string,
+ }
+}
+
+declare class QueueCompleteResponse extends jspb.Message {
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): QueueCompleteResponse.AsObject;
+ static toObject(includeInstance: boolean, msg: QueueCompleteResponse): QueueCompleteResponse.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: QueueCompleteResponse, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): QueueCompleteResponse;
+ static deserializeBinaryFromReader(message: QueueCompleteResponse, reader: jspb.BinaryReader): QueueCompleteResponse;
+}
+
+declare namespace QueueCompleteResponse {
+ export type AsObject = {
+ }
+}
+
+declare class FailedTask extends jspb.Message {
+ hasTask(): boolean;
+ clearTask(): void;
+ getTask(): NitricTask | undefined;
+ setTask(value?: NitricTask): void;
+
+ getMessage(): string;
+ setMessage(value: string): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): FailedTask.AsObject;
+ static toObject(includeInstance: boolean, msg: FailedTask): FailedTask.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: FailedTask, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): FailedTask;
+ static deserializeBinaryFromReader(message: FailedTask, reader: jspb.BinaryReader): FailedTask;
+}
+
+declare namespace FailedTask {
+ export type AsObject = {
+ task?: NitricTask.AsObject,
+ message: string,
+ }
+}
+
+declare class NitricTask extends jspb.Message {
+ getId(): string;
+ setId(value: string): void;
+
+ getLeaseId(): string;
+ setLeaseId(value: string): void;
+
+ getPayloadType(): string;
+ setPayloadType(value: string): void;
+
+ hasPayload(): boolean;
+ clearPayload(): void;
+ getPayload(): google_protobuf_struct_pb.Struct | undefined;
+ setPayload(value?: google_protobuf_struct_pb.Struct): void;
+
+ serializeBinary(): Uint8Array;
+ toObject(includeInstance?: boolean): NitricTask.AsObject;
+ static toObject(includeInstance: boolean, msg: NitricTask): NitricTask.AsObject;
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo};
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo};
+ static serializeBinaryToWriter(message: NitricTask, writer: jspb.BinaryWriter): void;
+ static deserializeBinary(bytes: Uint8Array): NitricTask;
+ static deserializeBinaryFromReader(message: NitricTask, reader: jspb.BinaryReader): NitricTask;
+}
+
+declare namespace NitricTask {
+ export type AsObject = {
+ id: string,
+ leaseId: string,
+ payloadType: string,
+ payload?: google_protobuf_struct_pb.Struct.AsObject,
+ }
+}
+
+// GENERATED CODE -- DO NOT EDIT!
+
+
+declare class QueueServiceClient extends grpc.Client {
+ constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
+ send(argument: QueueSendRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ send(argument: QueueSendRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ send(argument: QueueSendRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ sendBatch(argument: QueueSendBatchRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ sendBatch(argument: QueueSendBatchRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ sendBatch(argument: QueueSendBatchRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ receive(argument: QueueReceiveRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ receive(argument: QueueReceiveRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ receive(argument: QueueReceiveRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ complete(argument: QueueCompleteRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ complete(argument: QueueCompleteRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+ complete(argument: QueueCompleteRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall;
+}
+
+/**
+ * A message that has failed to be enqueued
+ */
+interface FailedMessage {
+ task: Task;
+ message: string;
+}
+/**
+ * Nitric queue client, facilitates pushing and popping to distributed queues.
+ */
+declare class Queueing {
+ QueueServiceClient: QueueServiceClient;
+ constructor();
+ queue: (name: string) => Queue;
+}
+declare class Queue {
+ queueing: Queueing;
+ name: string;
+ constructor(queueing: Queueing, name: string);
+ /**
+ * Send an task to a queue, which can be retrieved by other services.
+ *
+ * If an array of tasks is provided the returns promise will resolve to an array containing
+ * any tasks that failed to be sent to the queue.
+ *
+ * When a single task is provided a void promise will be returned, which rejects if the
+ * task fails to be sent to the queue.
+ *
+ * @param tasks one or more tasks to push to the queue
+ * @returns A void promise for a single task or a list of failed tasks when sending an array of tasks.
+ *
+ * Example:
+ * ```typescript
+ * import { Queueing } from "@nitric/sdk";
+ *
+ * const queueing = new Queueing();
+ * const queue = queueing.queue("my-queue")
+ * await queue.send({
+ * id: "1234";
+ * payloadType: "my-payload";
+ * payload: {
+ * value: "test"
+ * };
+ * });
+ */
+ send(tasks: Task[]): Promise;
+ send(tasks: Task): Promise;
+ /**
+ * Pop 1 or more queue items from the specified queue up to the depth limit.
+ *
+ * Nitric Tasks are leased for a limited period of time, where they may be worked on.
+ * Once complete or failed they must be acknowledged using request specified leaseId.
+ *
+ * If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be returned to the queue for reprocessing.
+ *
+ * @param depth the maximum number of items to return. Default 1, Min 1.
+ * @returns The list of received tasks
+ *
+ * Example:
+ * ```typescript
+ * import { Queueing } from "@nitric/sdk"
+ *
+ * const queueing = new Queueing();
+ *
+ * const [task] = await queueing.queue("my-queue").receive();
+ *
+ * // do something with task
+ * ```
+ */
+ receive(depth?: number): Promise;
+}
+declare class ReceivedTask implements Task {
+ id: string;
+ leaseId: string;
+ payloadType?: string;
+ payload?: Record;
+ queue: Queue;
+ constructor({ id, leaseId, payload, payloadType, queue, }: Task & {
+ id: string;
+ leaseId: string;
+ queue: Queue;
+ });
+ /**
+ * Marks a queue item as successfully completed and removes it from the queue.
+ *
+ * @returns A void promise
+ *
+ * Example:
+ * ```typescript
+ * import { Queueing } from "@nitric/sdk"
+ *
+ * const queueing = new Queueing();
+ *
+ * const [task] = await queueing.queue("my-queue").receive();
+ *
+ * // do something with task
+ *
+ * // complete the task
+ * await task.complete();
+ * ```
+ */
+ complete(): Promise