@wavemaker/variables 11.15.1-rc.248 → 11.15.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/build.js +4 -5
- package/scripts/build.js.map +1 -1
- package/src/interceptor/cache-interceptor.d.ts +11 -0
- package/src/interceptor/cache-interceptor.js +104 -0
- package/src/interceptor/cache-interceptor.js.map +1 -0
- package/src/interceptor/index.d.ts +9 -0
- package/src/interceptor/index.js +10 -0
- package/src/interceptor/index.js.map +1 -0
- package/src/interceptor/intercept-context.d.ts +15 -0
- package/src/interceptor/intercept-context.js +9 -0
- package/src/interceptor/intercept-context.js.map +1 -0
- package/src/interceptor/intercept.service.d.ts +6 -0
- package/src/interceptor/intercept.service.js +69 -0
- package/src/interceptor/intercept.service.js.map +1 -0
- package/src/interceptor/interceptor.d.ts +17 -0
- package/src/interceptor/interceptor.js +12 -0
- package/src/interceptor/interceptor.js.map +1 -0
- package/src/interceptor/interceptor.manager.d.ts +8 -0
- package/src/interceptor/interceptor.manager.js +17 -0
- package/src/interceptor/interceptor.manager.js.map +1 -0
- package/src/interceptor/storage.d.ts +28 -0
- package/src/interceptor/storage.js +144 -0
- package/src/interceptor/storage.js.map +1 -0
- package/src/util/variable/pagination.utils.d.ts +1 -10
- package/src/util/variable/pagination.utils.js +42 -79
- package/src/util/variable/pagination.utils.js.map +1 -1
- package/npm-shrinkwrap.json +0 -1976
- package/package-lock.json +0 -1976
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -124,17 +124,16 @@ function prepareNpmPackages(runtimeVersion) {
|
|
|
124
124
|
fs.copySync("".concat(projectDir, "/dist/es2015"), "".concat(projectDir, "/dist/npm-packages/package"), {
|
|
125
125
|
filter: function (p) { return !p.startsWith('/node_modules/'); }
|
|
126
126
|
});
|
|
127
|
-
|
|
128
|
-
case 1:
|
|
129
|
-
_a.sent();
|
|
127
|
+
//await createPackageLock(`${projectDir}/dist/npm-packages/package`);
|
|
130
128
|
return [4 /*yield*/, execa('tar', ['-czf', "dist/npm-packages/".concat(tarballName), '-C', 'dist/npm-packages', 'package'], {
|
|
131
129
|
'cwd': "".concat(projectDir)
|
|
132
130
|
})];
|
|
133
|
-
case
|
|
131
|
+
case 1:
|
|
132
|
+
//await createPackageLock(`${projectDir}/dist/npm-packages/package`);
|
|
134
133
|
_a.sent();
|
|
135
134
|
tarballPath = path.join(__dirname, "../dist/npm-packages/".concat(tarballName));
|
|
136
135
|
return [4 /*yield*/, execa('node', ['../process-npm-package-stats.js', "--path=".concat(tarballPath), '--packageName=@wavemaker/variables', "--publishVersion=".concat(runtimeVersion)])];
|
|
137
|
-
case
|
|
136
|
+
case 2:
|
|
138
137
|
stdout = (_a.sent()).stdout;
|
|
139
138
|
console.log(stdout);
|
|
140
139
|
return [2 /*return*/];
|
package/scripts/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"./","sources":["scripts/build.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,UAAU,GAAG,GAAG,CAAC;AACvB,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AACvB,IAAA,OAAO,GAAK,OAAO,CAAC,eAAe,CAAC,QAA7B,CAA8B;AAC7C,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B,SAAe,oBAAoB,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO;;;;YACrD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YACnD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC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,cAAc,EAAE,CAAC,IAAI,CAAC","sourcesContent":["const fs = require('fs-extra');\nconst path = require('path');\nconst projectDir = '.';\nconst yargs = require('yargs');\nconst { hideBin } = require('yargs/helpers');\nconst tar = require('tar');\nconst execa = require('execa');\n\nasync function updatePackageVersion(packagePath, key, version) {\n let content = fs.readFileSync(packagePath, 'utf8');\n content = content.replace(new RegExp(`\"${key}\"\\\\s*:\\\\s*\"[^\"]*\"`), `\"${key}\": \"${version}\"`);\n fs.writeFileSync(packagePath, content);\n}\n\nfunction updateSourceMapFile(path) {\n if (fs.lstatSync(path).isDirectory()) {\n fs.readdirSync(path).forEach(p => updateSourceMapFile(`${path}/${p}`));\n } else if(path.endsWith('js.map')) {\n const content = JSON.parse(fs.readFileSync(path, 'utf8'));\n content.sources[0] = content.sources[0].split('/').pop();\n fs.writeFileSync(path, JSON.stringify(content));\n }\n}\n\nasync function postBuild(runtimeVersion) {\n\n // updateSourceMapFile(`${projectDir}/dist/es2015`);\n\n fs.copySync(`${projectDir}/package.json`, `${projectDir}/dist/es2015/package.json`);\n\n const packageData = fs.readJSONSync(`${projectDir}/package.json`, {\n encoding: \"utf8\"\n });\n packageData.main = 'index';\n packageData.module = 'index';\n packageData.exports = {\n \".\": \"./index\"\n };\n delete packageData['files'];\n\n fs.writeFileSync(`${projectDir}/dist/es2015/package.json`, JSON.stringify(packageData, null, 2))\n await updatePackageVersion(`${projectDir}/dist/es2015/package.json`, 'version', runtimeVersion);\n console.log('Post Build successful!!!');\n}\n\nasync function createPackageLock(path) {\n await execa('npm', ['install', '--package-lock-only', '--ignore-scripts'], {\n 'cwd': path\n });\n const packageJSON = fs.readJSONSync(`${path}/package-lock.json`);\n Object.values(packageJSON.packages || {}).map(v => {\n delete v.resolved;\n });\n fs.writeJSONSync(`${path}/package-lock.json`, packageJSON, {\n spaces: 4\n });\n fs.writeJSONSync(`${path}/npm-shrinkwrap.json`, packageJSON, {\n spaces: 4\n });\n}\n\nasync function prepareNpmPackages(runtimeVersion) {\n let tarballName=`wavemaker-variables-${runtimeVersion}.tgz`\n fs.copySync(`${projectDir}/dist/es2015`, `${projectDir}/dist/npm-packages/package`, {\n filter: p => !p.startsWith('/node_modules/')\n });\n //await createPackageLock(`${projectDir}/dist/npm-packages/package`);\n await execa('tar', ['-czf', `dist/npm-packages/${tarballName}`, '-C', 'dist/npm-packages', 'package'], {\n 'cwd': `${projectDir}`\n });\n let tarballPath = path.join(__dirname, `../dist/npm-packages/${tarballName}`)\n const { stdout } = await execa('node', ['../process-npm-package-stats.js', `--path=${tarballPath}`, '--packageName=@wavemaker/variables', `--publishVersion=${runtimeVersion}`]);\n console.log(stdout);\n}\n\nasync function pushToLocalRepo() {\n fs.writeFileSync(`${projectDir}/dist/new-build`, '' + Date.now);\n await execa('yalc', ['publish' , '--no-sig', '--push'], {\n 'cwd': `${projectDir}/dist/es2015`\n });\n}\n\nyargs(hideBin(process.argv)).command('post-build',\n 'to run post processing after project build',\n (yargs) => {\n yargs.option('runtimeVersion', {\n describe: 'version number',\n type: 'string',\n default: '1.0.0-dev'\n }).option('production', {\n describe: 'to perform a production build',\n type: 'boolean',\n default: false\n });\n }, (argv) => {\n postBuild(argv.runtimeVersion).then(() => {\n if (argv.production) {\n return prepareNpmPackages(argv.runtimeVersion);\n } else {\n return pushToLocalRepo();\n }\n });\n }).showHelpOnFail().argv;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InterceptContext } from "./intercept-context";
|
|
2
|
+
import { BaseInterceptor, Interceptor } from "./interceptor";
|
|
3
|
+
export declare class CacheInterceptor<IC extends InterceptContext<any>> extends BaseInterceptor<IC> {
|
|
4
|
+
private interceptor;
|
|
5
|
+
private cacheType;
|
|
6
|
+
private cacheTimeout;
|
|
7
|
+
private passThrough;
|
|
8
|
+
constructor(interceptor: Interceptor<IC>, cacheType?: 'session' | 'persistent', cacheTimeout?: number, passThrough?: boolean);
|
|
9
|
+
match(context: IC): boolean;
|
|
10
|
+
intercept(context: IC): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import { BaseInterceptor } from "./interceptor";
|
|
53
|
+
var DEFAULT_CACHE_TIMEOUT = 5 * 60 * 1000;
|
|
54
|
+
var CacheInterceptor = /** @class */ (function (_super) {
|
|
55
|
+
__extends(CacheInterceptor, _super);
|
|
56
|
+
function CacheInterceptor(interceptor, cacheType, cacheTimeout, passThrough) {
|
|
57
|
+
if (cacheType === void 0) { cacheType = 'session'; }
|
|
58
|
+
if (cacheTimeout === void 0) { cacheTimeout = DEFAULT_CACHE_TIMEOUT; }
|
|
59
|
+
if (passThrough === void 0) { passThrough = false; }
|
|
60
|
+
var _this = _super.call(this, {}) || this;
|
|
61
|
+
_this.interceptor = interceptor;
|
|
62
|
+
_this.cacheType = cacheType;
|
|
63
|
+
_this.cacheTimeout = cacheTimeout;
|
|
64
|
+
_this.passThrough = passThrough;
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
CacheInterceptor.prototype.match = function (context) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return !!((_b = (_a = this.interceptor) === null || _a === void 0 ? void 0 : _a.match) === null || _b === void 0 ? void 0 : _b.call(_a, context));
|
|
70
|
+
};
|
|
71
|
+
CacheInterceptor.prototype.intercept = function (context) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var store, cacheData, data;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
store = context.stores.session;
|
|
78
|
+
if (this.cacheType === 'persistent') {
|
|
79
|
+
store = context.stores.persistent;
|
|
80
|
+
}
|
|
81
|
+
return [4 /*yield*/, store.getItem("response")];
|
|
82
|
+
case 1:
|
|
83
|
+
cacheData = _a.sent();
|
|
84
|
+
if (cacheData) {
|
|
85
|
+
context.variable.dataSet = cacheData;
|
|
86
|
+
if (!this.passThrough) {
|
|
87
|
+
return [2 /*return*/, cacheData];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return [4 /*yield*/, this.interceptor.intercept(context)];
|
|
91
|
+
case 2:
|
|
92
|
+
data = _a.sent();
|
|
93
|
+
return [4 /*yield*/, store.setItem("response", data, this.cacheTimeout)];
|
|
94
|
+
case 3:
|
|
95
|
+
_a.sent();
|
|
96
|
+
return [2 /*return*/, data];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
return CacheInterceptor;
|
|
102
|
+
}(BaseInterceptor));
|
|
103
|
+
export { CacheInterceptor };
|
|
104
|
+
//# sourceMappingURL=cache-interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-interceptor.js","sourceRoot":"./","sources":["src/interceptor/cache-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAe,MAAM,eAAe,CAAC;AAE7D,IAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE5C;IAAwE,oCAAmB;IAEvF,0BACY,WAA4B,EAC5B,SAA+C,EAC/C,YAAoC,EACpC,WAAmB;QAFnB,0BAAA,EAAA,qBAA+C;QAC/C,6BAAA,EAAA,oCAAoC;QACpC,4BAAA,EAAA,mBAAmB;QAE3B,YAAA,MAAK,YAAC,EAAE,CAAC,SAAC;QALF,iBAAW,GAAX,WAAW,CAAiB;QAC5B,eAAS,GAAT,SAAS,CAAsC;QAC/C,kBAAY,GAAZ,YAAY,CAAwB;QACpC,iBAAW,GAAX,WAAW,CAAQ;;IAG/B,CAAC;IAED,gCAAK,GAAL,UAAM,OAAW;;QACb,OAAO,CAAC,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,mDAAG,OAAO,CAAC,CAAA,CAAC;IAChD,CAAC;IAEK,oCAAS,GAAf,UAAgB,OAAW;;;;;;wBACnB,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;wBACnC,IAAG,IAAI,CAAC,SAAS,KAAK,YAAY,EAAE,CAAC;4BACjC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;wBACtC,CAAC;wBACiB,qBAAM,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAA;;wBAA3C,SAAS,GAAG,SAA+B;wBACjD,IAAI,SAAS,EAAE,CAAC;4BACZ,OAAO,CAAC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;4BACrC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gCACpB,sBAAO,SAAS,EAAC;4BACrB,CAAC;wBACL,CAAC;wBACY,qBAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,EAAA;;wBAAhD,IAAI,GAAG,SAAyC;wBACtD,qBAAM,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,EAAA;;wBAAxD,SAAwD,CAAC;wBACzD,sBAAO,IAAI,EAAC;;;;KACf;IACL,uBAAC;AAAD,CAAC,AA/BD,CAAwE,eAAe,GA+BtF","sourcesContent":["import { InterceptContext } from \"./intercept-context\";\nimport { BaseInterceptor, Interceptor } from \"./interceptor\";\n\nconst DEFAULT_CACHE_TIMEOUT = 5 * 60 * 1000;\n\nexport class CacheInterceptor<IC extends InterceptContext<any>> extends BaseInterceptor<IC> {\n \n constructor(\n private interceptor: Interceptor<IC>, \n private cacheType: 'session' | 'persistent' = 'session',\n private cacheTimeout = DEFAULT_CACHE_TIMEOUT,\n private passThrough = false\n ) {\n super({});\n }\n\n match(context: IC) {\n return !!this.interceptor?.match?.(context);\n }\n \n async intercept(context: IC) {\n let store = context.stores.session;\n if(this.cacheType === 'persistent') {\n store = context.stores.persistent;\n }\n const cacheData = await store.getItem(\"response\");\n if (cacheData) {\n context.variable.dataSet = cacheData;\n if (!this.passThrough) {\n return cacheData;\n }\n }\n const data = await this.interceptor.intercept(context);\n await store.setItem(\"response\", data, this.cacheTimeout);\n return data;\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./interceptor";
|
|
2
|
+
export * from "./cache-interceptor";
|
|
3
|
+
export * from "./storage";
|
|
4
|
+
export * from "./intercept-context";
|
|
5
|
+
import { InterceptorManager } from "./interceptor.manager";
|
|
6
|
+
import { InterceptService } from "./intercept.service";
|
|
7
|
+
declare const interceptorManager: InterceptorManager;
|
|
8
|
+
declare const interceptService: InterceptService;
|
|
9
|
+
export { interceptorManager, interceptService, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./interceptor";
|
|
2
|
+
export * from "./cache-interceptor";
|
|
3
|
+
export * from "./storage";
|
|
4
|
+
export * from "./intercept-context";
|
|
5
|
+
import { InterceptorManager } from "./interceptor.manager";
|
|
6
|
+
import { InterceptService } from "./intercept.service";
|
|
7
|
+
var interceptorManager = new InterceptorManager();
|
|
8
|
+
var interceptService = new InterceptService(interceptorManager);
|
|
9
|
+
export { interceptorManager, interceptService, };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"./","sources":["src/interceptor/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,IAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AACpD,IAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAElE,OAAO,EACH,kBAAkB,EAClB,gBAAgB,GACnB,CAAC","sourcesContent":["export * from \"./interceptor\";\nexport * from \"./cache-interceptor\";\nexport * from \"./storage\";\nexport * from \"./intercept-context\";\n\nimport { InterceptorManager } from \"./interceptor.manager\";\nimport { InterceptService } from \"./intercept.service\";\n\nconst interceptorManager = new InterceptorManager();\nconst interceptService = new InterceptService(interceptorManager);\n\nexport { \n interceptorManager, \n interceptService,\n};"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StorageService } from "./storage";
|
|
2
|
+
export declare abstract class InterceptContext<V> {
|
|
3
|
+
variable: V;
|
|
4
|
+
readonly stores: {
|
|
5
|
+
temp: StorageService;
|
|
6
|
+
session: StorageService;
|
|
7
|
+
persistent: StorageService;
|
|
8
|
+
};
|
|
9
|
+
constructor(variable: V, stores: {
|
|
10
|
+
temp: StorageService;
|
|
11
|
+
session: StorageService;
|
|
12
|
+
persistent: StorageService;
|
|
13
|
+
});
|
|
14
|
+
abstract proceed(): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var InterceptContext = /** @class */ (function () {
|
|
2
|
+
function InterceptContext(variable, stores) {
|
|
3
|
+
this.variable = variable;
|
|
4
|
+
this.stores = stores;
|
|
5
|
+
}
|
|
6
|
+
return InterceptContext;
|
|
7
|
+
}());
|
|
8
|
+
export { InterceptContext };
|
|
9
|
+
//# sourceMappingURL=intercept-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intercept-context.js","sourceRoot":"./","sources":["src/interceptor/intercept-context.ts"],"names":[],"mappings":"AAEA;IAEI,0BAAmB,QAAW,EAAkB,MAI/C;QAJkB,aAAQ,GAAR,QAAQ,CAAG;QAAkB,WAAM,GAAN,MAAM,CAIrD;IAAG,CAAC;IAGT,uBAAC;AAAD,CAAC,AATD,IASC","sourcesContent":["import { StorageService } from \"./storage\";\n\nexport abstract class InterceptContext<V> {\n\n constructor(public variable: V, public readonly stores: {\n temp: StorageService,\n session: StorageService,\n persistent: StorageService\n }) {}\n\n abstract proceed(): Promise<any>;\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var InterceptService = /** @class */ (function () {
|
|
38
|
+
function InterceptService(interceptorManager) {
|
|
39
|
+
this.interceptorManager = interceptorManager;
|
|
40
|
+
}
|
|
41
|
+
InterceptService.prototype.intercept = function (context) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
var matchingInterceptors;
|
|
44
|
+
var _this = this;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
matchingInterceptors = this.interceptorManager.filter(context);
|
|
49
|
+
if (matchingInterceptors.length === 0) {
|
|
50
|
+
return [2 /*return*/, context.proceed()];
|
|
51
|
+
}
|
|
52
|
+
return [4 /*yield*/, Promise.all(matchingInterceptors
|
|
53
|
+
.map(function (interceptor) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, interceptor.intercept(context)];
|
|
56
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
57
|
+
}
|
|
58
|
+
}); }); }))];
|
|
59
|
+
case 1:
|
|
60
|
+
_a.sent();
|
|
61
|
+
return [2 /*return*/, context.variable.dataSet];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return InterceptService;
|
|
67
|
+
}());
|
|
68
|
+
export { InterceptService };
|
|
69
|
+
//# sourceMappingURL=intercept.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intercept.service.js","sourceRoot":"./","sources":["src/interceptor/intercept.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IAEI,0BAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAE1D,CAAC;IAEK,oCAAS,GAAf,UAAgB,OAAY;;;;;;;wBAClB,oBAAoB,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wBACrE,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;4BACpC,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;wBAC7B,CAAC;wBACD,qBAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB;iCACjC,GAAG,CAAC,UAAM,WAAW;;4CAAI,qBAAM,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,EAAA;4CAApC,sBAAA,SAAoC,EAAA;;qCAAA,CAAC,CAAC,EAAA;;wBADpE,SACoE,CAAC;wBACrE,sBAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAC;;;;KACnC;IACL,uBAAC;AAAD,CAAC,AAfD,IAeC","sourcesContent":["import { InterceptorManager } from \"./interceptor.manager\";\n\nexport class InterceptService {\n \n constructor(private interceptorManager: InterceptorManager) {\n\n }\n\n async intercept(context: any) {\n const matchingInterceptors = this.interceptorManager.filter(context);\n if (matchingInterceptors.length === 0) {\n return context.proceed();\n }\n await Promise.all(matchingInterceptors\n .map(async interceptor => await interceptor.intercept(context)));\n return context.variable.dataSet;\n }\n}"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InterceptContext } from "./intercept-context";
|
|
2
|
+
export interface Interceptor<IC extends InterceptContext<any>> {
|
|
3
|
+
match: (context: IC) => boolean;
|
|
4
|
+
intercept: (context: IC) => Promise<any>;
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class BaseInterceptor<IC extends InterceptContext<any>> implements Interceptor<IC> {
|
|
7
|
+
protected options: {
|
|
8
|
+
match?: (context: IC) => boolean;
|
|
9
|
+
intercept?: (context: IC) => Promise<any>;
|
|
10
|
+
};
|
|
11
|
+
constructor(options: {
|
|
12
|
+
match?: (context: IC) => boolean;
|
|
13
|
+
intercept?: (context: IC) => Promise<any>;
|
|
14
|
+
});
|
|
15
|
+
match(context: IC): boolean;
|
|
16
|
+
abstract intercept(context: IC): Promise<any>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var BaseInterceptor = /** @class */ (function () {
|
|
2
|
+
function BaseInterceptor(options) {
|
|
3
|
+
this.options = options;
|
|
4
|
+
}
|
|
5
|
+
BaseInterceptor.prototype.match = function (context) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return !!((_b = (_a = this.options).match) === null || _b === void 0 ? void 0 : _b.call(_a, context));
|
|
8
|
+
};
|
|
9
|
+
return BaseInterceptor;
|
|
10
|
+
}());
|
|
11
|
+
export { BaseInterceptor };
|
|
12
|
+
//# sourceMappingURL=interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.js","sourceRoot":"./","sources":["src/interceptor/interceptor.ts"],"names":[],"mappings":"AAOA;IAEE,yBAAsB,OAGrB;QAHqB,YAAO,GAAP,OAAO,CAG5B;IACD,CAAC;IAED,+BAAK,GAAL,UAAM,OAAW;;QACf,OAAO,CAAC,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,OAAO,EAAC,KAAK,mDAAG,OAAO,CAAC,CAAA,CAAC;IACzC,CAAC;IAGH,sBAAC;AAAD,CAAC,AAbD,IAaC","sourcesContent":["import { InterceptContext } from \"./intercept-context\";\n\nexport interface Interceptor<IC extends InterceptContext<any>> {\n match: (context: IC) => boolean;\n intercept: (context: IC) => Promise<any>;\n}\n\nexport abstract class BaseInterceptor<IC extends InterceptContext<any>> implements Interceptor<IC> {\n\n constructor(protected options: {\n match?: (context: IC) => boolean;\n intercept?: (context: IC) => Promise<any>;\n }) {\n }\n\n match(context: IC) {\n return !!this.options.match?.(context);\n }\n\n abstract intercept(context: IC): Promise<any>;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InterceptContext } from "./intercept-context";
|
|
2
|
+
import { Interceptor } from "./interceptor";
|
|
3
|
+
export declare class InterceptorManager {
|
|
4
|
+
private interceptors;
|
|
5
|
+
add(interceptor: Interceptor<any>): void;
|
|
6
|
+
remove(interceptor: Interceptor<any>): void;
|
|
7
|
+
filter(contextToMatch: InterceptContext<any>): Interceptor<any>[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var InterceptorManager = /** @class */ (function () {
|
|
2
|
+
function InterceptorManager() {
|
|
3
|
+
this.interceptors = [];
|
|
4
|
+
}
|
|
5
|
+
InterceptorManager.prototype.add = function (interceptor) {
|
|
6
|
+
this.interceptors.push(interceptor);
|
|
7
|
+
};
|
|
8
|
+
InterceptorManager.prototype.remove = function (interceptor) {
|
|
9
|
+
this.interceptors = this.interceptors.filter(function (i) { return i !== interceptor; });
|
|
10
|
+
};
|
|
11
|
+
InterceptorManager.prototype.filter = function (contextToMatch) {
|
|
12
|
+
return this.interceptors.filter(function (i) { return i.match(contextToMatch); });
|
|
13
|
+
};
|
|
14
|
+
return InterceptorManager;
|
|
15
|
+
}());
|
|
16
|
+
export { InterceptorManager };
|
|
17
|
+
//# sourceMappingURL=interceptor.manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.manager.js","sourceRoot":"./","sources":["src/interceptor/interceptor.manager.ts"],"names":[],"mappings":"AAGA;IAAA;QAEY,iBAAY,GAAuB,EAAE,CAAC;IAalD,CAAC;IAXG,gCAAG,GAAH,UAAI,WAA6B;QAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED,mCAAM,GAAN,UAAO,WAA6B;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,WAAW,EAAjB,CAAiB,CAAC,CAAC;IACzE,CAAC;IAED,mCAAM,GAAN,UAAO,cAAqC;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,EAAvB,CAAuB,CAAC,CAAC;IAClE,CAAC;IACL,yBAAC;AAAD,CAAC,AAfD,IAeC","sourcesContent":["import { InterceptContext } from \"./intercept-context\";\nimport { Interceptor } from \"./interceptor\";\n\nexport class InterceptorManager {\n\n private interceptors: Interceptor<any>[] = [];\n\n add(interceptor: Interceptor<any>) {\n this.interceptors.push(interceptor);\n }\n\n remove(interceptor: Interceptor<any>) {\n this.interceptors = this.interceptors.filter(i => i !== interceptor);\n }\n\n filter(contextToMatch: InterceptContext<any>) {\n return this.interceptors.filter(i => i.match(contextToMatch));\n }\n}"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface StorageService {
|
|
2
|
+
setItem(key: string, value: any, ttl: number): Promise<void>;
|
|
3
|
+
getItem(key: string): Promise<any>;
|
|
4
|
+
removeItem(key: string): Promise<void>;
|
|
5
|
+
clear(): Promise<any>;
|
|
6
|
+
}
|
|
7
|
+
declare class SimpleStorageService implements StorageService {
|
|
8
|
+
private cache;
|
|
9
|
+
private keyPrefix;
|
|
10
|
+
constructor(cache: any, keyPrefix: string);
|
|
11
|
+
getKey(key: string): string;
|
|
12
|
+
getTtlKey(key: string): string;
|
|
13
|
+
setItem(key: string, value: any, ttl: number): Promise<void>;
|
|
14
|
+
getItem(key: string): Promise<any>;
|
|
15
|
+
removeItem(key: string): Promise<void>;
|
|
16
|
+
clear(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare class SessionStorageService extends SimpleStorageService {
|
|
19
|
+
static cache: any;
|
|
20
|
+
static inerval: NodeJS.Timeout | null;
|
|
21
|
+
private constructor();
|
|
22
|
+
static getInstance(keyPrefix: string): SessionStorageService;
|
|
23
|
+
}
|
|
24
|
+
export declare class TemporaryStorageService extends SimpleStorageService {
|
|
25
|
+
private constructor();
|
|
26
|
+
static getInstance(keyPrefix: string): TemporaryStorageService;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var TTL_KEY_SUFFIX = '_ttl';
|
|
53
|
+
var SimpleStorageService = /** @class */ (function () {
|
|
54
|
+
function SimpleStorageService(cache, keyPrefix) {
|
|
55
|
+
this.cache = cache;
|
|
56
|
+
this.keyPrefix = keyPrefix;
|
|
57
|
+
this.keyPrefix = keyPrefix;
|
|
58
|
+
}
|
|
59
|
+
SimpleStorageService.prototype.getKey = function (key) {
|
|
60
|
+
return this.keyPrefix + key;
|
|
61
|
+
};
|
|
62
|
+
SimpleStorageService.prototype.getTtlKey = function (key) {
|
|
63
|
+
return this.getKey(key) + TTL_KEY_SUFFIX;
|
|
64
|
+
};
|
|
65
|
+
SimpleStorageService.prototype.setItem = function (key, value, ttl) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
this.cache[this.getKey(key)] = value;
|
|
69
|
+
if (ttl && ttl > 0) {
|
|
70
|
+
this.cache[this.getTtlKey(key)] = Date.now() + ttl;
|
|
71
|
+
}
|
|
72
|
+
return [2 /*return*/];
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
SimpleStorageService.prototype.getItem = function (key) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var value, ttl;
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
switch (_a.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
value = this.cache[this.getKey(key)];
|
|
83
|
+
if (!value) return [3 /*break*/, 2];
|
|
84
|
+
ttl = this.cache[this.getTtlKey(key)];
|
|
85
|
+
if (!(ttl && ttl < Date.now())) return [3 /*break*/, 2];
|
|
86
|
+
return [4 /*yield*/, this.removeItem(key)];
|
|
87
|
+
case 1:
|
|
88
|
+
_a.sent();
|
|
89
|
+
return [2 /*return*/, null];
|
|
90
|
+
case 2: return [2 /*return*/, value];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
SimpleStorageService.prototype.removeItem = function (key) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
delete this.cache[this.getKey(key)];
|
|
99
|
+
delete this.cache[this.getTtlKey(key)];
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
SimpleStorageService.prototype.clear = function () {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
// For SessionStorageService, clear the static cache
|
|
108
|
+
if (this.cache === SessionStorageService.cache) {
|
|
109
|
+
SessionStorageService.cache = {};
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.cache = {};
|
|
113
|
+
}
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
return SimpleStorageService;
|
|
119
|
+
}());
|
|
120
|
+
var SessionStorageService = /** @class */ (function (_super) {
|
|
121
|
+
__extends(SessionStorageService, _super);
|
|
122
|
+
function SessionStorageService(keyPrefix) {
|
|
123
|
+
return _super.call(this, SessionStorageService.cache, keyPrefix) || this;
|
|
124
|
+
}
|
|
125
|
+
SessionStorageService.getInstance = function (keyPrefix) {
|
|
126
|
+
return new SessionStorageService(keyPrefix);
|
|
127
|
+
};
|
|
128
|
+
SessionStorageService.cache = {};
|
|
129
|
+
SessionStorageService.inerval = null;
|
|
130
|
+
return SessionStorageService;
|
|
131
|
+
}(SimpleStorageService));
|
|
132
|
+
export { SessionStorageService };
|
|
133
|
+
var TemporaryStorageService = /** @class */ (function (_super) {
|
|
134
|
+
__extends(TemporaryStorageService, _super);
|
|
135
|
+
function TemporaryStorageService(keyPrefix) {
|
|
136
|
+
return _super.call(this, {}, keyPrefix) || this;
|
|
137
|
+
}
|
|
138
|
+
TemporaryStorageService.getInstance = function (keyPrefix) {
|
|
139
|
+
return new TemporaryStorageService(keyPrefix);
|
|
140
|
+
};
|
|
141
|
+
return TemporaryStorageService;
|
|
142
|
+
}(SimpleStorageService));
|
|
143
|
+
export { TemporaryStorageService };
|
|
144
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"./","sources":["src/interceptor/storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAM,cAAc,GAAG,MAAM,CAAC;AAE9B;IAEI,8BAAoB,KAAU,EAAU,SAAiB;QAArC,UAAK,GAAL,KAAK,CAAK;QAAU,cAAS,GAAT,SAAS,CAAQ;QACrD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,qCAAM,GAAN,UAAO,GAAW;QACd,OAAO,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IAChC,CAAC;IAED,wCAAS,GAAT,UAAU,GAAW;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;IAC7C,CAAC;IAEY,sCAAO,GAApB,UAAqB,GAAW,EAAE,KAAU,EAAE,GAAW;;;gBACrD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;gBACrC,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;oBACjB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC;gBACvD,CAAC;;;;KACJ;IAEY,sCAAO,GAApB,UAAqB,GAAW;;;;;;wBACtB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;6BACvC,KAAK,EAAL,wBAAK;wBACC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAA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B;QAChC,OAAO,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;IACL,8BAAC;AAAD,CAAC,AARD,CAA6C,oBAAoB,GAQhE","sourcesContent":["export interface StorageService {\n setItem(key: string, value: any, ttl: number): Promise<void>;\n getItem(key: string): Promise<any>;\n removeItem(key: string): Promise<void>;\n clear(): Promise<any>;\n}\n\nconst TTL_KEY_SUFFIX = '_ttl';\n\nclass SimpleStorageService implements StorageService {\n\n constructor(private cache: any, private keyPrefix: string) {\n this.keyPrefix = keyPrefix;\n }\n\n getKey(key: string) {\n return this.keyPrefix + key;\n }\n\n getTtlKey(key: string) {\n return this.getKey(key) + TTL_KEY_SUFFIX;\n }\n\n public async setItem(key: string, value: any, ttl: number) {\n this.cache[this.getKey(key)] = value;\n if (ttl && ttl > 0) {\n this.cache[this.getTtlKey(key)] = Date.now() + ttl;\n }\n }\n\n public async getItem(key: string) {\n const value = this.cache[this.getKey(key)];\n if (value) {\n const ttl = this.cache[this.getTtlKey(key)];\n if (ttl && ttl < Date.now()) {\n await this.removeItem(key);\n return null;\n }\n }\n return value;\n }\n\n public async removeItem(key: string) {\n delete this.cache[this.getKey(key)];\n delete this.cache[this.getTtlKey(key)];\n }\n\n public async clear() {\n // For SessionStorageService, clear the static cache\n if (this.cache === SessionStorageService.cache) {\n SessionStorageService.cache = {} as any;\n } else {\n this.cache = {} as any;\n }\n }\n}\n\nexport class SessionStorageService extends SimpleStorageService {\n static cache = {} as any;\n static inerval: NodeJS.Timeout | null = null;\n\n private constructor(keyPrefix: string) {\n super(SessionStorageService.cache, keyPrefix);\n }\n\n static getInstance(keyPrefix: string) {\n return new SessionStorageService(keyPrefix);\n }\n}\n\nexport class TemporaryStorageService extends SimpleStorageService {\n private constructor(keyPrefix: string) {\n super({}, keyPrefix);\n }\n\n static getInstance(keyPrefix: string) {\n return new TemporaryStorageService(keyPrefix);\n }\n}"]}
|
|
@@ -67,7 +67,7 @@ export declare class PaginationUtils {
|
|
|
67
67
|
* @param variable withholds variable information
|
|
68
68
|
* @returns {void} This method does not return anything
|
|
69
69
|
*/
|
|
70
|
-
static setParameterVal(paramName: any, res: any, operationInfo: any, variable: any
|
|
70
|
+
static setParameterVal(paramName: any, res: any, operationInfo: any, variable: any): void;
|
|
71
71
|
/**
|
|
72
72
|
* Creates res object from the response recieved from the api triggered
|
|
73
73
|
* @param variable withholds variable information
|
|
@@ -79,13 +79,4 @@ export declare class PaginationUtils {
|
|
|
79
79
|
* @returns {object} An object which holds the information of pagination which has to be stored on the variable
|
|
80
80
|
*/
|
|
81
81
|
static generatePaginationRes(operationInfo: any, paginationInfo: any, response: any, resHeaders: any, options: any, variable: any): {};
|
|
82
|
-
/**
|
|
83
|
-
* If totalElements has $minValue in it, set totalElements as $minValue
|
|
84
|
-
* If the rendered elements are greater than $minValue, set totalElements as Number of elements rendered + 1
|
|
85
|
-
|
|
86
|
-
* If totalElements is present in the pagination's output metadata deduce totalElements from api's response
|
|
87
|
-
|
|
88
|
-
* If Pagination type is offset, deduce totalElements from size and options[page] else deduce from size and res[page]
|
|
89
|
-
*/
|
|
90
|
-
static setTotalElements(resOutput: any, options: any, res: any, variable: any, response: any, paginationInfo: any, resHeaders: any): void;
|
|
91
82
|
}
|