npm package diff
Package: @forge/storage
Versions: 1.5.15-experimental-f6dcf26 - 1.5.15-experimental-204139e
Added:package/out/entity-storage/custom-entity-transaction-api.js
Added:package/out/kvs-transaction-api.js
Added:package/out/transaction-api.js
Added:package/out/__test__/transaction-api.test.js
Added:package/out/entity-storage/__test__/transaction-api.test.js
Added:package/out/entity-storage/custom-entity-transaction-api.d.ts.map
Added:package/out/kvs-transaction-api.d.ts.map
Added:package/out/transaction-api.d.ts.map
Added:package/out/__test__/transaction-api.test.d.ts.map
Added:package/out/entity-storage/__test__/transaction-api.test.d.ts.map
Added:package/out/entity-storage/custom-entity-transaction-api.d.ts
Added:package/out/kvs-transaction-api.d.ts
Added:package/out/transaction-api.d.ts
Added:package/out/__test__/transaction-api.test.d.ts
Added:package/out/entity-storage/__test__/transaction-api.test.d.ts
Modified:package/out/global-storage.js
Index: package/out/global-storage.js
===================================================================
--- package/out/global-storage.js
+++ package/out/global-storage.js
@@ -55,8 +55,18 @@
results,
nextCursor
};
}
+ async transaction(options, isCustomEntity) {
+ if (isCustomEntity) {
+ const requestBody = gql_queries_1.CustomEntityQueries.transaction(this.doGetAppContextAri(), options);
+ await this.mutation(requestBody, 'appStorageCustomEntity', 'transactAppStoredCustomEntity');
+ }
+ else {
+ const requestBody = gql_queries_1.UntypedQueries.transaction(this.doGetAppContextAri(), options);
+ await this.mutation(requestBody, 'appStorage', 'transactAppStoredEntity');
+ }
+ }
async listCustomEntities(options) {
const requestBody = gql_queries_1.CustomEntityQueries.listQuery(this.doGetAppContextAri(), options);
const response = await this.query(requestBody);
const edges = response.appStoredCustomEntities.edges;
Modified:package/out/gql-queries.js
Index: package/out/gql-queries.js
===================================================================
--- package/out/gql-queries.js
+++ package/out/gql-queries.js
@@ -144,8 +144,32 @@
encrypted
}
}
});
+ static transaction = (contextAri, items) => ({
+ query: `
+ mutation forge_app_setApplicationStorageTransact($input: TransactMutationInput!) {
+ appStorage {
+ transactAppStoredEntity(input: $input) {
+ success
+ errors {
+ message
+ extensions {
+ errorType
+ statusCode
+ }
+ }
+ }
+ }
+ }
+ `,
+ variables: {
+ input: {
+ contextAri,
+ items
+ }
+ }
+ });
}
exports.UntypedQueries = UntypedQueries;
class CustomEntityQueries {
static get = (contextAri, entityName, key) => ({
@@ -256,6 +280,30 @@
...(options.limit ? { limit: options.limit } : {})
}
};
};
+ static transaction = (contextAri, items) => ({
+ query: `
+ mutation forge_app_setApplicationStorageTransact($input: TransactMutationInput!) {
+ appStorageCustomEntity {
+ transactAppStoredCustomEntity(input: $input) {
+ success
+ errors {
+ message
+ extensions {
+ errorType
+ statusCode
+ }
+ }
+ }
+ }
+ }
+ `,
+ variables: {
+ input: {
+ contextAri,
+ items
+ }
+ }
+ });
}
exports.CustomEntityQueries = CustomEntityQueries;
Modified:package/out/index.js
Index: package/out/index.js
===================================================================
--- package/out/index.js
+++ package/out/index.js
@@ -2,8 +2,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomEntityIndexBuilder = exports.APIError = exports.SortOrder = exports.EntityStorageBuilder = exports.FilterConditions = exports.WhereConditions = exports.startsWith = exports.GlobalStorage = exports.getStorageInstanceWithQuery = void 0;
const entity_storage_1 = require("./entity-storage");
const query_api_1 = require("./query-api");
+const transaction_api_1 = require("./transaction-api");
const getStorageInstanceWithQuery = (adapter) => {
return {
get: adapter.get.bind(adapter),
set: adapter.set.bind(adapter),
@@ -12,8 +13,9 @@
setSecret: adapter.setSecret.bind(adapter),
deleteSecret: adapter.deleteSecret.bind(adapter),
bulkSet: adapter.bulkSet.bind(adapter),
query: () => new query_api_1.DefaultQueryBuilder(adapter),
+ transaction: () => new transaction_api_1.DefaultTransactionBuilder(adapter),
entity: (entityName) => new entity_storage_1.EntityStorageBuilder(entityName, adapter)
};
};
exports.getStorageInstanceWithQuery = getStorageInstanceWithQuery;
Modified:package/package.json
Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
{
"name": "@forge/storage",
- "version": "1.5.15-experimental-f6dcf26",
+ "version": "1.5.15-experimental-204139e",
"description": "Forge Storage methods",
"author": "Atlassian",
"license": "UNLICENSED",
"main": "out/index.js",
Modified:package/out/global-storage.d.ts.map
Index: package/out/global-storage.d.ts.map
===================================================================
--- package/out/global-storage.d.ts.map
+++ package/out/global-storage.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"global-storage.d.ts","sourceRoot":"","sources":["../src/global-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,UAAU,WAAW;IACnB,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA2CD,qBAAa,aAAc,YAAW,oBAAoB;IAGtD,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,SAAS;IAHnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;gBAE5C,gBAAgB,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,EACzC,SAAS,EAAE,WAAW;IAGhC,OAAO,CAAC,kBAAkB;IAIpB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI9B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIpC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBhD,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IAc1E,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,C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AAC,WAAW,CAAC;IAc1E,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAgBjD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI/D,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5E,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAK1D,WAAW;YAUX,iBAAiB;IAU/B,OAAO,CAAC,YAAY;YAUN,KAAK;YAML,QAAQ;CA6BvB"}
\ No newline at end of file
Modified:package/out/gql-queries.d.ts.map
Index: package/out/gql-queries.d.ts.map
===================================================================
--- package/out/gql-queries.d.ts.map
+++ package/out/gql-queries.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"gql-queries.d.ts","sourceRoot":"","sources":["../src/gql-queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,qBAAa,cAAc;IACzB,OAAc,GAAG,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;MAcr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AAM,WAAW,WAAW;;;;;;;;MAuBhE;IAEH,OAAc,mBAAmB,eAAgB,MAAM,WAAW,WAAW;;;;;;;;MAuB1E;IAEH,OAAc,OAAO,eAAgB,MAAM,UAAU,QAAQ,EAAE,aAAa,OAAO;;;;;;;;;MA8BhF;IAEH,OAAc,WAAW,eAAgB,MAAM,SAAS,uBAAuB;;;;;;;;MAuB5E;CACJ;AAED,qBAAa,mBAAmB;IAC9B,OAAc,GAAG,eAAgB,MAAM,cAAc,MAAM,OAAO,MAAM;;;;;;;MAerE;IAEH,OAAc,GAAG,eAAgB,MAAM,cAAc,MAAM,OAAO,MAAM,SAAS,GAAG;;;;;;;;;;MA0BjF;IAEH,OAAc,MAAM,eAAgB,MAAM,cAAc,MAAM,OAAO,MAAM;;;;;;;;;MAyBxE;IAEH,OAAc,SAAS,eAAgB,MAAM,WAAW,uBAAuB;;;;;;;;;;;;;;;MAuC7E;IAEF,OAAc,WAAW,eAAgB,MAAM,SAAS,uBAAuB;;;;;;;;MAuB5E;CACJ"}
\ No newline at end of file
Modified:package/out/index.d.ts.map
Index: package/out/index.d.ts.map
===================================================================
--- package/out/index.d.ts.map
+++ package/out/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,oBAAY,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAC3G,oBAAY,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAA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AAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,YAAa,aAAa;;;;;;;;iBASnD,mBAAmB;uBACb,yBAAyB;4BAClB,MAAM;CAEjC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc,EACd,QAAQ,EACR,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
\ No newline at end of file
Modified:package/out/storage-adapter.d.ts.map
Index: package/out/storage-adapter.d.ts.map
===================================================================
--- package/out/storage-adapter.d.ts.map
+++ package/out/storage-adapter.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../src/storage-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,UAAU,EACV,UAAU,EACV,EAAE,EACF,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB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,CAAC,GAAG,MAAM;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM;IACpC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
\ No newline at end of file
+{"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../src/storage-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,UAAU,EACV,UAAU,EACV,EAAE,EACF,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC;CAChE;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AACD,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG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xB,cAAc,GACd,qBAAqB,CAAC;AAE1B,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,MAAM;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM;IACpC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
\ No newline at end of file
Modified:package/out/global-storage.d.ts
Index: package/out/global-storage.d.ts
===================================================================
--- package/out/global-storage.d.ts
+++ package/out/global-storage.d.ts
@@ -1,14 +1,34 @@
import { BulkResponse, FetchMethod } from './index';
-import { CustomEntityListOptions, ListOptions } from './query-interfaces';
+import { CustomEntityListOptions, FilterClause, ListOptions } from './query-interfaces';
import { BulkItem, SharedStorageAdapter } from './storage-adapter';
interface ListResults {
results: {
key: string;
value: any;
}[];
nextCursor?: string;
}
+export declare type colorsEnum = 'or' | 'and';
+declare type TransactionRequestCondition = {
+ [key in colorsEnum]?: FilterClause[];
+};
+export interface TransactionRequestSet {
+ key: string;
+ value: string | number | boolean | Record<string, any> | any[];
+ entityName?: string;
+ conditions?: TransactionRequestCondition;
+}
+export interface TransactionRequestDeleteCheck {
+ key: string;
+ entityName?: string;
+ conditions?: TransactionRequestCondition;
+}
+export interface TransactionRequestInput {
+ set?: TransactionRequestSet[];
+ delete?: TransactionRequestDeleteCheck[];
+ check?: TransactionRequestDeleteCheck[];
+}
export declare class GlobalStorage implements SharedStorageAdapter {
private getAppContextAri;
private apiClient;
private readonly endpoint;
@@ -16,8 +36,9 @@
private doGetAppContextAri;
get(key: string): Promise<any>;
getSecret(key: string): Promise<any>;
list(options: ListOptions): Promise<ListResults>;
+ transaction(options: TransactionRequestInput, isCustomEntity?: boolean): Promise<void>;
listCustomEntities(options: CustomEntityListOptions): Promise<ListResults>;
set(key: string, value: any): Promise<void>;
setSecret(key: string, value: any): Promise<void>;
bulkSet(items: BulkItem[]): Promise<BulkResponse>;
Modified:package/out/gql-queries.d.ts
Index: package/out/gql-queries.d.ts
===================================================================
--- package/out/gql-queries.d.ts
+++ package/out/gql-queries.d.ts
@@ -1,4 +1,5 @@
+import { TransactionRequestInput } from './global-storage';
import { CustomEntityListOptions, ListOptions } from './query-interfaces';
import { BulkItem } from './storage-adapter';
export declare class UntypedQueries {
static get: (contextAri: string, key: string, encrypted: boolean) => {
@@ -57,8 +58,17 @@
encrypted: boolean;
};
};
};
+ static transaction: (contextAri: string, items: TransactionRequestInput) => {
+ query: string;
+ variables: {
+ input: {
+ contextAri: string;
+ items: TransactionRequestInput;
+ };
+ };
+ };
}
export declare class CustomEntityQueries {
static get: (contextAri: string, entityName: string, key: string) => {
query: string;
@@ -104,6 +114,15 @@
indexName: string | undefined;
range: import("./query-interfaces").RangeClause | undefined;
};
};
+ static transaction: (contextAri: string, items: TransactionRequestInput) => {
+ query: string;
+ variables: {
+ input: {
+ contextAri: string;
+ items: TransactionRequestInput;
+ };
+ };
+ };
}
//# sourceMappingURL=gql-queries.d.ts.map
\ No newline at end of file
Modified:package/out/index.d.ts
Index: package/out/index.d.ts
===================================================================
--- package/out/index.d.ts
+++ package/out/index.d.ts
@@ -1,8 +1,9 @@
import { RequestInit, Response } from 'node-fetch';
import { EntityStorageBuilder } from './entity-storage';
import { GlobalStorage } from './global-storage';
import { DefaultQueryBuilder } from './query-api';
+import { DefaultTransactionBuilder } from './transaction-api';
export declare type APIResponse = Pick<Response, 'json' | 'text' | 'arrayBuffer' | 'ok' | 'status' | 'statusText'>;
export declare type FetchMethod = (url: string, init: RequestInit) => Promise<APIResponse>;
export declare const getStorageInstanceWithQuery: (adapter: GlobalStorage) => {
get: (key: string) => Promise<any>;
@@ -12,16 +13,16 @@
setSecret: (key: string, value: any) => Promise<void>;
deleteSecret: (key: string) => Promise<void>;
bulkSet: (items: import("./storage-adapter").BulkItem[]) => Promise<import("./storage-adapter").BulkResponse>;
query: () => DefaultQueryBuilder;
+ transaction: () => DefaultTransactionBuilder;
entity: <T>(entityName: string) => EntityStorageBuilder<T>;
};
export { GlobalStorage } from './global-storage';
export { startsWith } from './conditions';
export { WhereConditions, FilterConditions } from './eap/conditions';
-export { QueryBuilder, QueryApi, Condition, ListResult, Predicate, Result, EntityStorageApi, WherePredicate, FilterPredicate } from './storage-adapter';
+export { QueryBuilder, QueryApi, Condition, ListResult, Predicate, Result, EntityStorageApi, WherePredicate, FilterPredicate, TransactionApi, BulkItem, BulkResponse } from './storage-adapter';
export { EntityStorageBuilder, EntityStorageBuilderType } from './entity-storage';
export { Value, SortOrder } from './query-interfaces';
export { APIError } from './errors';
-export { BulkItem, BulkResponse } from './storage-adapter';
export { CustomEntityIndexBuilder } from './entity-storage/query-api';
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
Modified:package/out/storage-adapter.d.ts
Index: package/out/storage-adapter.d.ts
===================================================================
--- package/out/storage-adapter.d.ts
+++ package/out/storage-adapter.d.ts
@@ -1,5 +1,6 @@
import { EntityStorageBuilderType } from './entity-storage';
+import { CustomEntityTransactionBuilder } from './entity-storage/custom-entity-transaction-api';
import { BeginsWithClause, BetweenClause, ExistsClause, DoesNotExistClause, GreaterThanClause, GreaterThanEqualToClause, StartsWith, NotEqualTo, In, LessThanClause, LessThanEqualToClause, ContainsClause, DoesNotContainClause, IsNotEqualToClause, EqualToClause } from './query-interfaces';
export interface BulkItem {
key: string;
value: string | number | boolean | Record<string, any> | any[];
@@ -33,8 +34,11 @@
export declare type SharedStorageAdapter = StorageAdapter & EntityStorageAdapter;
export interface QueryApi {
query(): QueryBuilder;
}
+export interface TransactionApi {
+ transaction(): TransactionBuilder;
+}
export declare type Predicate = StartsWith | NotEqualTo | In;
export declare type Condition = Predicate;
export interface QueryBuilder {
where(field: 'key', condition: Condition): QueryBuilder;
@@ -42,8 +46,18 @@
limit(limit: number): QueryBuilder;
getMany(): Promise<ListResult>;
getOne(): Promise<Result | undefined>;
}
+export interface KVSTransactionBuilderInterface {
+ set(key: string, value: string | number | boolean | Record<string, any> | any[]): KVSTransactionBuilderInterface;
+ delete(key: string): KVSTransactionBuilderInterface;
+ execute(): Promise<void>;
+}
+export interface TransactionBuilder {
+ entity(name: string): CustomEntityTransactionBuilder;
+ set(key: string, value: string | number | boolean | Record<string, any> | any[]): KVSTransactionBuilderInterface;
+ delete(key: string): KVSTransactionBuilderInterface;
+}
export declare type FilterPredicate = BetweenClause | BeginsWithClause | ExistsClause | DoesNotExistClause | GreaterThanClause | GreaterThanEqualToClause | LessThanClause | LessThanEqualToClause | ContainsClause | DoesNotContainClause | EqualToClause | IsNotEqualToClause;
export declare type WherePredicate = BetweenClause | BeginsWithClause | EqualToClause | GreaterThanClause | GreaterThanEqualToClause | LessThanClause | LessThanEqualToClause;
export interface Result<T = object> {
key: string;