@mondaycom/apps-sdk
Advanced tools
Comparing version 3.0.11 to 3.0.12-beta
"use strict"; | ||
exports.__esModule = true; | ||
exports["default"] = { name: '@mondaycom/apps-sdk', version: '3.0.11' }; | ||
exports["default"] = { name: '@mondaycom/apps-sdk', version: '3.0.12-beta' }; | ||
//# sourceMappingURL=minimal-package.js.map |
{ | ||
"name": "@mondaycom/apps-sdk", | ||
"version": "3.0.11", | ||
"version": "3.0.12-beta", | ||
"description": "monday apps SDK for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
@@ -150,2 +150,8 @@ "use strict"; | ||
}; | ||
BaseStorage.prototype.searchUrl = function (key, options) { | ||
var storageUrl = this.getStorageUrlV2(); | ||
var cursor = options.cursor ? "&cursor=".concat(options.cursor) : ''; | ||
var fullPath = "".concat(storageUrl, "/items?term=").concat(key).concat(cursor); | ||
return fullPath; | ||
}; | ||
return BaseStorage; | ||
@@ -152,0 +158,0 @@ }()); |
@@ -78,3 +78,6 @@ "use strict"; | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.storageFetchV2(this.counterUrl(), { method: 'PUT', body: __assign(__assign({}, (options || {})), { period: period }) })]; | ||
case 0: return [4 /*yield*/, this.storageFetchV2(this.counterUrl(), { | ||
method: 'PUT', | ||
body: __assign(__assign({}, (options || {})), { period: period }) | ||
})]; | ||
case 1: | ||
@@ -113,2 +116,26 @@ result = _b.sent(); | ||
}; | ||
Storage.prototype.search = function (key, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, params, result, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
url = this.searchUrl(key, options); | ||
params = { method: 'GET' }; | ||
return [4 /*yield*/, this.storageFetchV2(url, params)]; | ||
case 1: | ||
result = _a.sent(); | ||
if (!(0, guards_1.isDefined)(result)) { | ||
return [2 /*return*/, { success: false, records: null }]; | ||
} | ||
response = { success: true, records: result.records }; | ||
if (result.cursor) { | ||
response.cursor = result.cursor; | ||
} | ||
return [2 /*return*/, response]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Storage.prototype.get = function (key, options) { | ||
@@ -115,0 +142,0 @@ if (options === void 0) { options = {}; } |
@@ -1,2 +0,2 @@ | ||
export default { name: '@mondaycom/apps-sdk', version: '3.0.11' }; | ||
export default { name: '@mondaycom/apps-sdk', version: '3.0.12-beta' }; | ||
//# sourceMappingURL=minimal-package.js.map |
{ | ||
"name": "@mondaycom/apps-sdk", | ||
"version": "3.0.11", | ||
"version": "3.0.12-beta", | ||
"description": "monday apps SDK for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
@@ -147,2 +147,8 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
BaseStorage.prototype.searchUrl = function (key, options) { | ||
var storageUrl = this.getStorageUrlV2(); | ||
var cursor = options.cursor ? "&cursor=".concat(options.cursor) : ''; | ||
var fullPath = "".concat(storageUrl, "/items?term=").concat(key).concat(cursor); | ||
return fullPath; | ||
}; | ||
return BaseStorage; | ||
@@ -149,0 +155,0 @@ }()); |
@@ -75,3 +75,6 @@ var __extends = (this && this.__extends) || (function () { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.storageFetchV2(this.counterUrl(), { method: 'PUT', body: __assign(__assign({}, (options || {})), { period: period }) })]; | ||
case 0: return [4 /*yield*/, this.storageFetchV2(this.counterUrl(), { | ||
method: 'PUT', | ||
body: __assign(__assign({}, (options || {})), { period: period }) | ||
})]; | ||
case 1: | ||
@@ -110,2 +113,26 @@ result = _b.sent(); | ||
}; | ||
Storage.prototype.search = function (key, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, params, result, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
url = this.searchUrl(key, options); | ||
params = { method: 'GET' }; | ||
return [4 /*yield*/, this.storageFetchV2(url, params)]; | ||
case 1: | ||
result = _a.sent(); | ||
if (!isDefined(result)) { | ||
return [2 /*return*/, { success: false, records: null }]; | ||
} | ||
response = { success: true, records: result.records }; | ||
if (result.cursor) { | ||
response.cursor = result.cursor; | ||
} | ||
return [2 /*return*/, response]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Storage.prototype.get = function (key, options) { | ||
@@ -112,0 +139,0 @@ if (options === void 0) { options = {}; } |
import { RequestOptions } from '../types/fetch'; | ||
import { Options, Token } from '../types/storage'; | ||
import { Options, SearchOptions, Token } from '../types/storage'; | ||
import { Logger } from '../utils/logger'; | ||
@@ -14,2 +14,3 @@ export declare abstract class BaseStorage { | ||
counterUrl(): string; | ||
searchUrl(key: string, options: SearchOptions): string; | ||
} |
import { BaseStorage } from '../storage/base-storage'; | ||
import { JsonValue } from '../types/general'; | ||
import { CounterOptions, GetResponse, IStorageInstance, Options, Period } from '../types/storage'; | ||
import { CounterOptions, GetResponse, IStorageInstance, Options, Period, SearchOptions, SearchResponse } from '../types/storage'; | ||
export declare class Storage extends BaseStorage implements IStorageInstance { | ||
@@ -23,2 +23,3 @@ incrementCounter(period: Period, options?: CounterOptions): Promise<{ | ||
}>; | ||
search<T extends JsonValue>(key: string, options?: SearchOptions): Promise<SearchResponse<T>>; | ||
get<T extends JsonValue>(key: string, options?: Options): Promise<GetResponse<T>>; | ||
@@ -25,0 +26,0 @@ set(key: string, value: any, options?: Options): Promise<{ |
@@ -17,2 +17,5 @@ import { JsonValue } from './general'; | ||
}; | ||
export type SearchOptions = { | ||
cursor?: string; | ||
}; | ||
export type GetServerResponse<T extends JsonValue> = { | ||
@@ -26,2 +29,15 @@ version?: string; | ||
} & GetServerResponse<T>; | ||
export type SearchEntity<T extends JsonValue> = { | ||
key: string; | ||
value: T; | ||
backendOnly: boolean; | ||
}; | ||
export type SearchServerResponse<T extends JsonValue> = { | ||
records: Array<SearchEntity<T>> | null; | ||
cursor?: string; | ||
}; | ||
export type SearchResponse<T extends JsonValue> = { | ||
success: boolean; | ||
error?: string; | ||
} & SearchServerResponse<T>; | ||
export type CounterResponse = { | ||
@@ -28,0 +44,0 @@ message: string; |
{ | ||
"name": "@mondaycom/apps-sdk", | ||
"version": "3.0.11", | ||
"version": "3.0.12-beta", | ||
"description": "monday apps SDK for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303304
4160
1