@flowcore/sdk 1.19.1 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/esm/commands/data-core/data-core.request-delete.d.ts +6 -0
- package/esm/commands/data-core/data-core.request-delete.d.ts.map +1 -1
- package/esm/commands/data-core/data-core.request-delete.js +12 -0
- package/esm/commands/event-type/event-type.info.d.ts +2 -0
- package/esm/commands/event-type/event-type.info.d.ts.map +1 -1
- package/esm/commands/event-type/event-type.info.js +3 -0
- package/esm/commands/event-type/event-type.request-delete.d.ts +6 -0
- package/esm/commands/event-type/event-type.request-delete.d.ts.map +1 -1
- package/esm/commands/event-type/event-type.request-delete.js +12 -0
- package/esm/commands/event-type/event-type.request-truncate.d.ts +7 -1
- package/esm/commands/event-type/event-type.request-truncate.d.ts.map +1 -1
- package/esm/commands/event-type/event-type.request-truncate.js +12 -0
- package/esm/commands/events/event.list.d.ts +6 -0
- package/esm/commands/events/event.list.d.ts.map +1 -1
- package/esm/commands/events/event.list.js +12 -0
- package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts +4 -0
- package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -1
- package/esm/commands/events/events.fetch-time-buckets-by-names.js +13 -1
- package/esm/commands/events/events.fetch.d.ts +4 -0
- package/esm/commands/events/events.fetch.d.ts.map +1 -1
- package/esm/commands/events/events.fetch.js +12 -0
- package/esm/commands/events/time-bucket.list.d.ts +6 -0
- package/esm/commands/events/time-bucket.list.d.ts.map +1 -1
- package/esm/commands/events/time-bucket.list.js +13 -1
- package/esm/commands/flow-type/flow-type.request-delete.d.ts +7 -1
- package/esm/commands/flow-type/flow-type.request-delete.d.ts.map +1 -1
- package/esm/commands/flow-type/flow-type.request-delete.js +12 -0
- package/esm/commands/index.d.ts +1 -0
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +1 -0
- package/esm/commands/security/pat.exchange.d.ts.map +1 -1
- package/esm/commands/security/permissions.list.d.ts +28 -0
- package/esm/commands/security/permissions.list.d.ts.map +1 -0
- package/esm/commands/security/permissions.list.js +38 -0
- package/esm/commands/tenant/tenant.translate-name-to-id.d.ts.map +1 -1
- package/esm/common/command.d.ts +9 -1
- package/esm/common/command.d.ts.map +1 -1
- package/esm/common/command.js +39 -3
- package/esm/common/flowcore-client.d.ts +9 -0
- package/esm/common/flowcore-client.d.ts.map +1 -1
- package/esm/common/flowcore-client.js +23 -1
- package/esm/common/tenant.cache.d.ts +17 -0
- package/esm/common/tenant.cache.d.ts.map +1 -0
- package/esm/common/tenant.cache.js +2 -0
- package/esm/contracts/pat.d.ts.map +1 -1
- package/esm/contracts/permission.d.ts +21 -0
- package/esm/contracts/permission.d.ts.map +1 -0
- package/esm/contracts/permission.js +16 -0
- package/esm/utils/local-cache.d.ts +11 -0
- package/esm/utils/local-cache.d.ts.map +1 -0
- package/esm/utils/local-cache.js +45 -0
- package/esm/utils/try-catch.d.ts +12 -0
- package/esm/utils/try-catch.d.ts.map +1 -0
- package/esm/utils/try-catch.js +10 -0
- package/package.json +1 -1
- package/script/commands/data-core/data-core.request-delete.d.ts +6 -0
- package/script/commands/data-core/data-core.request-delete.d.ts.map +1 -1
- package/script/commands/data-core/data-core.request-delete.js +12 -0
- package/script/commands/event-type/event-type.info.d.ts +2 -0
- package/script/commands/event-type/event-type.info.d.ts.map +1 -1
- package/script/commands/event-type/event-type.info.js +3 -0
- package/script/commands/event-type/event-type.request-delete.d.ts +6 -0
- package/script/commands/event-type/event-type.request-delete.d.ts.map +1 -1
- package/script/commands/event-type/event-type.request-delete.js +12 -0
- package/script/commands/event-type/event-type.request-truncate.d.ts +7 -1
- package/script/commands/event-type/event-type.request-truncate.d.ts.map +1 -1
- package/script/commands/event-type/event-type.request-truncate.js +12 -0
- package/script/commands/events/event.list.d.ts +6 -0
- package/script/commands/events/event.list.d.ts.map +1 -1
- package/script/commands/events/event.list.js +12 -0
- package/script/commands/events/events.fetch-time-buckets-by-names.d.ts +4 -0
- package/script/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -1
- package/script/commands/events/events.fetch-time-buckets-by-names.js +13 -1
- package/script/commands/events/events.fetch.d.ts +4 -0
- package/script/commands/events/events.fetch.d.ts.map +1 -1
- package/script/commands/events/events.fetch.js +12 -0
- package/script/commands/events/time-bucket.list.d.ts +6 -0
- package/script/commands/events/time-bucket.list.d.ts.map +1 -1
- package/script/commands/events/time-bucket.list.js +13 -1
- package/script/commands/flow-type/flow-type.request-delete.d.ts +7 -1
- package/script/commands/flow-type/flow-type.request-delete.d.ts.map +1 -1
- package/script/commands/flow-type/flow-type.request-delete.js +12 -0
- package/script/commands/index.d.ts +1 -0
- package/script/commands/index.d.ts.map +1 -1
- package/script/commands/index.js +1 -0
- package/script/commands/security/pat.exchange.d.ts.map +1 -1
- package/script/commands/security/permissions.list.d.ts +28 -0
- package/script/commands/security/permissions.list.d.ts.map +1 -0
- package/script/commands/security/permissions.list.js +42 -0
- package/script/commands/tenant/tenant.translate-name-to-id.d.ts.map +1 -1
- package/script/common/command.d.ts +9 -1
- package/script/common/command.d.ts.map +1 -1
- package/script/common/command.js +39 -3
- package/script/common/flowcore-client.d.ts +9 -0
- package/script/common/flowcore-client.d.ts.map +1 -1
- package/script/common/flowcore-client.js +23 -1
- package/script/common/tenant.cache.d.ts +17 -0
- package/script/common/tenant.cache.d.ts.map +1 -0
- package/script/common/tenant.cache.js +5 -0
- package/script/contracts/pat.d.ts.map +1 -1
- package/script/contracts/permission.d.ts +21 -0
- package/script/contracts/permission.d.ts.map +1 -0
- package/script/contracts/permission.js +19 -0
- package/script/utils/local-cache.d.ts +11 -0
- package/script/utils/local-cache.d.ts.map +1 -0
- package/script/utils/local-cache.js +49 -0
- package/script/utils/try-catch.d.ts +12 -0
- package/script/utils/try-catch.d.ts.map +1 -0
- package/script/utils/try-catch.js +13 -0
|
@@ -3,6 +3,8 @@ import { Command } from "../../common/command.js";
|
|
|
3
3
|
* The input for the events fetch indexes command
|
|
4
4
|
*/
|
|
5
5
|
export interface TimeBucketListInput {
|
|
6
|
+
/** the tenant */
|
|
7
|
+
tenant: string;
|
|
6
8
|
/** the event type ids */
|
|
7
9
|
eventTypeId: [string, ...string[]] | string;
|
|
8
10
|
/** the start time */
|
|
@@ -29,6 +31,10 @@ export interface TimeBucketListOutput {
|
|
|
29
31
|
* Fetch time buckets for an event type
|
|
30
32
|
*/
|
|
31
33
|
export declare class TimeBucketListCommand extends Command<TimeBucketListInput, TimeBucketListOutput> {
|
|
34
|
+
/**
|
|
35
|
+
* The dedicated subdomain for the command
|
|
36
|
+
*/
|
|
37
|
+
protected dedicatedSubdomain: string;
|
|
32
38
|
/**
|
|
33
39
|
* Get the method for the request
|
|
34
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-bucket.list.d.ts","sourceRoot":"","sources":["../../../src/commands/events/time-bucket.list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-bucket.list.d.ts","sourceRoot":"","sources":["../../../src/commands/events/time-bucket.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,yBAAyB;IACzB,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAAA;IAC3C,qBAAqB;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mBAAmB;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB;IAChB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAUD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAChD,mBAAmB,EACnB,oBAAoB,CACrB;IACC;;OAEG;IACH,UAAmB,kBAAkB,EAAE,MAAM,CAAiB;IAE9D;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAGvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAepC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,oBAAoB;CAI7E"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimeBucketListCommand = void 0;
|
|
4
4
|
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
-
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
6
5
|
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
7
|
/**
|
|
8
8
|
* The response schema for the events fetch time buckets by names command
|
|
9
9
|
*/
|
|
@@ -15,6 +15,18 @@ const responseSchema = typebox_1.Type.Object({
|
|
|
15
15
|
* Fetch time buckets for an event type
|
|
16
16
|
*/
|
|
17
17
|
class TimeBucketListCommand extends command_js_1.Command {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/**
|
|
21
|
+
* The dedicated subdomain for the command
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(this, "dedicatedSubdomain", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: "event-source"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
18
30
|
/**
|
|
19
31
|
* Get the method for the request
|
|
20
32
|
*/
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Command } from "../../common/command.js";
|
|
2
|
-
import type { ClientError } from "../../exceptions/client-error.js";
|
|
3
2
|
import type { FlowcoreClient } from "../../common/flowcore-client.js";
|
|
3
|
+
import type { ClientError } from "../../exceptions/client-error.js";
|
|
4
4
|
/**
|
|
5
5
|
* The input for the flow type request delete command
|
|
6
6
|
*/
|
|
7
7
|
export interface FlowTypeRequestDeleteInput {
|
|
8
|
+
/** The tenant */
|
|
9
|
+
tenant: string;
|
|
8
10
|
/** The id of the flow type */
|
|
9
11
|
flowTypeId: string;
|
|
10
12
|
/** Wait for the flow type to be deleted (default: false) */
|
|
@@ -20,6 +22,10 @@ export interface FlowTypeRequestDeleteOutput {
|
|
|
20
22
|
* Request to delete a flow type
|
|
21
23
|
*/
|
|
22
24
|
export declare class FlowTypeRequestDeleteCommand extends Command<FlowTypeRequestDeleteInput, FlowTypeRequestDeleteOutput> {
|
|
25
|
+
/**
|
|
26
|
+
* The dedicated subdomain for the command
|
|
27
|
+
*/
|
|
28
|
+
protected dedicatedSubdomain: string;
|
|
23
29
|
/**
|
|
24
30
|
* Get the method
|
|
25
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-type.request-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/flow-type/flow-type.request-delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-type.request-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/flow-type/flow-type.request-delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAKnE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,OAAO,CAAC,0BAA0B,EAAE,2BAA2B,CAAC;IAChH;;OAEG;IACH,UAAmB,kBAAkB,EAAE,MAAM,CAAmB;IAEhE;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,2BAA2B;IAUnF;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAS9D;;OAEG;cACsB,eAAe,CACtC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,2BAA2B,GACpC,OAAO,CAAC,2BAA2B,CAAC;CAkBxC"}
|
|
@@ -10,6 +10,18 @@ const flow_type_exists_js_1 = require("./flow-type.exists.js");
|
|
|
10
10
|
* Request to delete a flow type
|
|
11
11
|
*/
|
|
12
12
|
class FlowTypeRequestDeleteCommand extends command_js_1.Command {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
/**
|
|
16
|
+
* The dedicated subdomain for the command
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(this, "dedicatedSubdomain", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: "delete-manager"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
13
25
|
/**
|
|
14
26
|
* Get the method
|
|
15
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,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xC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAG5C,cAAc,mDAAmD,CAAA;AACjE,cAAc,mDAAmD,CAAA;AACjE,cAAc,kDAAkD,CAAA;AAChE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,mDAAmD,CAAA;AAGjE,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA"}
|
package/script/commands/index.js
CHANGED
|
@@ -74,3 +74,4 @@ __exportStar(require("./security/pat.delete.js"), exports);
|
|
|
74
74
|
__exportStar(require("./security/pat.exchange.js"), exports);
|
|
75
75
|
__exportStar(require("./security/pat.get.js"), exports);
|
|
76
76
|
__exportStar(require("./security/pat.list.js"), exports);
|
|
77
|
+
__exportStar(require("./security/permissions.list.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pat.exchange.d.ts","sourceRoot":"","sources":["../../../src/commands/security/pat.exchange.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,2BAA2B;IAC1C,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,mBAAmB,EAAE,2BAA2B,CAAC;IACvG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;cAIpB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMvD;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,2BAA2B;
|
|
1
|
+
{"version":3,"file":"pat.exchange.d.ts","sourceRoot":"","sources":["../../../src/commands/security/pat.exchange.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,2BAA2B;IAC1C,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,mBAAmB,EAAE,2BAA2B,CAAC;IACvG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;cAIpB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMvD;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,2BAA2B;CAQpF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
import { type Permission } from "../../contracts/permission.js";
|
|
3
|
+
export interface PermissionsListInput {
|
|
4
|
+
/** Filter by the type of the frn */
|
|
5
|
+
type?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fetch an event type
|
|
9
|
+
*/
|
|
10
|
+
export declare class PermissionsListCommand extends Command<PermissionsListInput, Permission[]> {
|
|
11
|
+
/**
|
|
12
|
+
* Get the method
|
|
13
|
+
*/
|
|
14
|
+
protected getMethod(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the base url
|
|
17
|
+
*/
|
|
18
|
+
protected getBaseUrl(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the path
|
|
21
|
+
*/
|
|
22
|
+
protected getPath(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Parse the response
|
|
25
|
+
*/
|
|
26
|
+
protected parseResponse(rawResponse: unknown): Permission[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=permissions.list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.list.d.ts","sourceRoot":"","sources":["../../../src/commands/security/permissions.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,+BAA+B,CAAA;AAEjF,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,oBAAoB,EAAE,UAAU,EAAE,CAAC;IACrF;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAQpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,EAAE;CAIrE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PermissionsListCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
const permission_js_1 = require("../../contracts/permission.js");
|
|
8
|
+
/**
|
|
9
|
+
* Fetch an event type
|
|
10
|
+
*/
|
|
11
|
+
class PermissionsListCommand extends command_js_1.Command {
|
|
12
|
+
/**
|
|
13
|
+
* Get the method
|
|
14
|
+
*/
|
|
15
|
+
getMethod() {
|
|
16
|
+
return "GET";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the base url
|
|
20
|
+
*/
|
|
21
|
+
getBaseUrl() {
|
|
22
|
+
return "https://iam.api.flowcore.io";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the path
|
|
26
|
+
*/
|
|
27
|
+
getPath() {
|
|
28
|
+
const queryParams = new URLSearchParams();
|
|
29
|
+
if (this.input.type) {
|
|
30
|
+
queryParams.set("type", this.input.type);
|
|
31
|
+
}
|
|
32
|
+
return `/api/v1/permissions?${queryParams.toString()}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parse the response
|
|
36
|
+
*/
|
|
37
|
+
parseResponse(rawResponse) {
|
|
38
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Array(permission_js_1.PermissionSchema), rawResponse);
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.PermissionsListCommand = PermissionsListCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant.translate-name-to-id.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.translate-name-to-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"tenant.translate-name-to-id.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.translate-name-to-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAInE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,OAAO,CAAC;IAClD,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;CACd,CAGC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAElF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,OAAO,CAAC,4BAA4B,EAAE,uBAAuB,CAAC;IAChH;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,uBAAuB;IAK/E;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAQ/D"}
|
|
@@ -8,6 +8,10 @@ export declare abstract class Command<Input, Output> {
|
|
|
8
8
|
* Whether the command should retry on failure
|
|
9
9
|
*/
|
|
10
10
|
protected readonly retryOnFailure: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The dedicated subdomain for the command
|
|
13
|
+
*/
|
|
14
|
+
protected readonly dedicatedSubdomain?: string;
|
|
11
15
|
/**
|
|
12
16
|
* The allowed modes for the command
|
|
13
17
|
*/
|
|
@@ -17,6 +21,10 @@ export declare abstract class Command<Input, Output> {
|
|
|
17
21
|
*/
|
|
18
22
|
protected readonly input: Input;
|
|
19
23
|
constructor(input: Input);
|
|
24
|
+
/**
|
|
25
|
+
* Get the dedicated base URL
|
|
26
|
+
*/
|
|
27
|
+
protected getDedicatedBaseUrl(client: FlowcoreClient): Promise<string | null>;
|
|
20
28
|
/**
|
|
21
29
|
* Get the base URL for the request
|
|
22
30
|
*/
|
|
@@ -48,7 +56,7 @@ export declare abstract class Command<Input, Output> {
|
|
|
48
56
|
/**
|
|
49
57
|
* Get the request object
|
|
50
58
|
*/
|
|
51
|
-
getRequest(
|
|
59
|
+
getRequest(client: FlowcoreClient): Promise<{
|
|
52
60
|
allowedModes: ("apiKey" | "bearer")[];
|
|
53
61
|
body: string | Record<string, unknown> | Array<unknown> | undefined;
|
|
54
62
|
headers: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/common/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/common/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAG1D;;GAEG;AACH,8BAAsB,OAAO,CAAC,KAAK,EAAE,MAAM;IACzC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAO;IAEjD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE9C;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAuB;IAE/E;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;gBAEnB,KAAK,EAAE,KAAK;IAOxB;;OAEG;cACa,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA6BnF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAEvC;;OAEG;IACH,SAAS,CAAC,SAAS,IAAI,M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,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F"}
|
package/script/common/command.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Command = void 0;
|
|
4
|
+
const tenant_fetch_js_1 = require("../commands/tenant/tenant.fetch.js");
|
|
5
|
+
const command_error_js_1 = require("../exceptions/command-error.js");
|
|
6
|
+
const tenant_cache_js_1 = require("./tenant.cache.js");
|
|
4
7
|
/**
|
|
5
8
|
* Abstract command for executing requests
|
|
6
9
|
*/
|
|
@@ -15,6 +18,15 @@ class Command {
|
|
|
15
18
|
writable: true,
|
|
16
19
|
value: true
|
|
17
20
|
});
|
|
21
|
+
/**
|
|
22
|
+
* The dedicated subdomain for the command
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(this, "dedicatedSubdomain", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
18
30
|
/**
|
|
19
31
|
* The allowed modes for the command
|
|
20
32
|
*/
|
|
@@ -38,6 +50,31 @@ class Command {
|
|
|
38
50
|
*/
|
|
39
51
|
this.input = input;
|
|
40
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the dedicated base URL
|
|
55
|
+
*/
|
|
56
|
+
async getDedicatedBaseUrl(client) {
|
|
57
|
+
if (!this.dedicatedSubdomain) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const inputTenant = typeof this.input === "object" && this.input !== null && "tenant" in this.input &&
|
|
61
|
+
typeof this.input.tenant === "string" && this.input.tenant;
|
|
62
|
+
if (!inputTenant) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
let tenant = tenant_cache_js_1.tenantCache.get(inputTenant);
|
|
66
|
+
if (!tenant) {
|
|
67
|
+
tenant = await client.execute(new tenant_fetch_js_1.TenantFetchCommand({ tenant: inputTenant }));
|
|
68
|
+
tenant_cache_js_1.tenantCache.set(inputTenant, tenant);
|
|
69
|
+
}
|
|
70
|
+
if (!tenant.isDedicated) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
if (!tenant.dedicated?.configuration.domain) {
|
|
74
|
+
throw new command_error_js_1.CommandError(this.constructor.name, `Tenant ${inputTenant} does not have a dedicated domain configured`);
|
|
75
|
+
}
|
|
76
|
+
return `https://${this.dedicatedSubdomain}.${tenant.dedicated.configuration.domain}`;
|
|
77
|
+
}
|
|
41
78
|
/**
|
|
42
79
|
* Get the method for the request
|
|
43
80
|
*/
|
|
@@ -78,13 +115,12 @@ class Command {
|
|
|
78
115
|
/**
|
|
79
116
|
* Get the request object
|
|
80
117
|
*/
|
|
81
|
-
|
|
82
|
-
async getRequest(_client) {
|
|
118
|
+
async getRequest(client) {
|
|
83
119
|
return {
|
|
84
120
|
allowedModes: this.allowedModes,
|
|
85
121
|
body: this.getBody(),
|
|
86
122
|
headers: this.getHeaders(),
|
|
87
|
-
baseUrl: this.getBaseUrl(),
|
|
123
|
+
baseUrl: (await this.getDedicatedBaseUrl(client)) ?? this.getBaseUrl(),
|
|
88
124
|
path: this.getPath(),
|
|
89
125
|
method: this.getMethod(),
|
|
90
126
|
parseResponse: this.parseResponse.bind(this),
|
|
@@ -51,6 +51,15 @@ export declare class FlowcoreClient {
|
|
|
51
51
|
* Execute a command
|
|
52
52
|
*/
|
|
53
53
|
execute<Input, Output>(command: Command<Input, Output>): Promise<Output>;
|
|
54
|
+
/**
|
|
55
|
+
* Close the client and clean up resources
|
|
56
|
+
* This should be called when the client is no longer needed to prevent memory leaks
|
|
57
|
+
*/
|
|
58
|
+
close(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Dispose the client
|
|
61
|
+
*/
|
|
62
|
+
[Symbol.dispose](): void;
|
|
54
63
|
}
|
|
55
64
|
export {};
|
|
56
65
|
//# sourceMappingURL=flowcore-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowcore-client.d.ts","sourceRoot":"","sources":["../../src/common/flowcore-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"flowcore-client.d.ts","sourceRoot":"","sources":["../../src/common/flowcore-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAM3C;;GAEG;AACH,UAAU,mBAAmB;IAC3B,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAA;IAC5D,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAErE;;GAEG;AACH,qBAAa,cAAc;IAIb,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,OAAO,CAAoB;gBAEN,OAAO,EAAE,aAAa;IAiBnD;;OAEG;YACW,aAAa;IAc3B;;OAEG;YACW,YAAY;IA4E1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxE;;;OAGG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGzB"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowcoreClient = void 0;
|
|
4
4
|
const client_error_js_1 = require("../exceptions/client-error.js");
|
|
5
5
|
const command_error_js_1 = require("../exceptions/command-error.js");
|
|
6
|
+
const try_catch_js_1 = require("../utils/try-catch.js");
|
|
7
|
+
const tenant_cache_js_1 = require("./tenant.cache.js");
|
|
6
8
|
const RETRYABLE_ERROR_CODES = [408, 429, 500, 502, 503, 504];
|
|
7
9
|
/**
|
|
8
10
|
* A base client for executing commands
|
|
@@ -70,7 +72,13 @@ class FlowcoreClient {
|
|
|
70
72
|
if (!request.allowedModes.includes(this.mode)) {
|
|
71
73
|
throw new command_error_js_1.CommandError(command.constructor.name, `Not allowed in "${this.mode}" mode`);
|
|
72
74
|
}
|
|
73
|
-
const authHeader = await this.getAuthHeader();
|
|
75
|
+
const { data: authHeader, error: authHeaderError } = await (0, try_catch_js_1.tryCatch)(this.getAuthHeader());
|
|
76
|
+
if (authHeaderError) {
|
|
77
|
+
throw new client_error_js_1.ClientError("Failed to get auth header", 0, command.constructor.name, {
|
|
78
|
+
command: command.constructor.name,
|
|
79
|
+
error: authHeaderError,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
74
82
|
const headers = {
|
|
75
83
|
...request.headers,
|
|
76
84
|
...(authHeader ? { Authorization: authHeader } : {}),
|
|
@@ -129,5 +137,19 @@ class FlowcoreClient {
|
|
|
129
137
|
execute(command) {
|
|
130
138
|
return this.innerExecute(command, 0);
|
|
131
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Close the client and clean up resources
|
|
142
|
+
* This should be called when the client is no longer needed to prevent memory leaks
|
|
143
|
+
*/
|
|
144
|
+
close() {
|
|
145
|
+
// Clear the tenant cache
|
|
146
|
+
tenant_cache_js_1.tenantCache.clear();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Dispose the client
|
|
150
|
+
*/
|
|
151
|
+
[Symbol.dispose]() {
|
|
152
|
+
this.close();
|
|
153
|
+
}
|
|
132
154
|
}
|
|
133
155
|
exports.FlowcoreClient = FlowcoreClient;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LocalCache } from "../utils/local-cache.js";
|
|
2
|
+
export declare const tenantCache: LocalCache<{
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
description: string;
|
|
7
|
+
websiteUrl: string;
|
|
8
|
+
isDedicated: boolean;
|
|
9
|
+
dedicated: {
|
|
10
|
+
status: "ready" | "degraded" | "offline";
|
|
11
|
+
configuration: {
|
|
12
|
+
domain: string;
|
|
13
|
+
configurationRepoUrl: string;
|
|
14
|
+
};
|
|
15
|
+
} | null;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=tenant.cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant.cache.d.ts","sourceRoot":"","sources":["../../src/common/tenant.cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;EAAoC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pat.d.ts","sourceRoot":"","sources":["../../src/contracts/pat.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"pat.d.ts","sourceRoot":"","sources":["../../src/contracts/pat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEjG;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC;IAC9B,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IACzB,SAAS,EAAE,OAAO,CAAA;CACnB,CAMC,CAAA;AACF;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Static, type TArray, type TLiteral, type TObject, type TString, type TUnion } from "@sinclair/typebox";
|
|
2
|
+
/**
|
|
3
|
+
* The schema for a permission
|
|
4
|
+
*/
|
|
5
|
+
export declare const PermissionSchema: TObject<{
|
|
6
|
+
tenant: TString;
|
|
7
|
+
type: TString;
|
|
8
|
+
id: TString;
|
|
9
|
+
action: TArray<TUnion<[
|
|
10
|
+
TLiteral<"read">,
|
|
11
|
+
TLiteral<"write">,
|
|
12
|
+
TLiteral<"ingest">,
|
|
13
|
+
TLiteral<"fetch">,
|
|
14
|
+
TLiteral<"*">
|
|
15
|
+
]>>;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* The type for a permission
|
|
19
|
+
*/
|
|
20
|
+
export type Permission = Static<typeof PermissionSchema>;
|
|
21
|
+
//# sourceMappingURL=permission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../src/contracts/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,mBAAmB,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC;IACrC,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,OAAO,CAAA;IACX,MAAM,EAAE,MAAM,CACZ,MAAM,CAAC;QACL,QAAQ,CAAC,MAAM,CAAC;QAChB,QAAQ,CAAC,OAAO,CAAC;QACjB,QAAQ,CAAC,QAAQ,CAAC;QAClB,QAAQ,CAAC,OAAO,CAAC;QACjB,QAAQ,CAAC,GAAG,CAAC;KACd,CAAC,CACH,CAAA;CACF,CAaC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PermissionSchema = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
/**
|
|
6
|
+
* The schema for a permission
|
|
7
|
+
*/
|
|
8
|
+
exports.PermissionSchema = typebox_1.Type.Object({
|
|
9
|
+
tenant: typebox_1.Type.String(),
|
|
10
|
+
type: typebox_1.Type.String(),
|
|
11
|
+
id: typebox_1.Type.String(),
|
|
12
|
+
action: typebox_1.Type.Array(typebox_1.Type.Union([
|
|
13
|
+
typebox_1.Type.Literal("read"),
|
|
14
|
+
typebox_1.Type.Literal("write"),
|
|
15
|
+
typebox_1.Type.Literal("ingest"),
|
|
16
|
+
typebox_1.Type.Literal("fetch"),
|
|
17
|
+
typebox_1.Type.Literal("*"),
|
|
18
|
+
])),
|
|
19
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class LocalCache<T> {
|
|
2
|
+
private readonly defaultTtlMs?;
|
|
3
|
+
private cache;
|
|
4
|
+
private timers;
|
|
5
|
+
constructor(defaultTtlMs?: number | undefined);
|
|
6
|
+
get(key: string): T | undefined;
|
|
7
|
+
set(key: string, value: T, ttlMs?: number): void;
|
|
8
|
+
delete(key: string): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=local-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-cache.d.ts","sourceRoot":"","sources":["../../src/utils/local-cache.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU,CAAC,CAAC;IAKX,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAJ1C,OAAO,CAAC,KAAK,CAA4B;IAEzC,OAAO,CAAC,MAAM,CAA8B;gBAEf,YAAY,CAAC,EAAE,MAAM,YAAA;IAElD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;IASzC,MAAM,CAAC,GAAG,EAAE,MAAM;IAKlB,KAAK;CAON"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalCache = void 0;
|
|
4
|
+
class LocalCache {
|
|
5
|
+
constructor(defaultTtlMs) {
|
|
6
|
+
Object.defineProperty(this, "defaultTtlMs", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: defaultTtlMs
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "cache", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: new Map()
|
|
17
|
+
});
|
|
18
|
+
// deno-lint-ignore no-explicit-any
|
|
19
|
+
Object.defineProperty(this, "timers", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: new Map()
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
get(key) {
|
|
27
|
+
return this.cache.get(key);
|
|
28
|
+
}
|
|
29
|
+
set(key, value, ttlMs) {
|
|
30
|
+
clearTimeout(this.timers.get(key));
|
|
31
|
+
this.cache.set(key, value);
|
|
32
|
+
if (ttlMs ?? this.defaultTtlMs) {
|
|
33
|
+
const timer = setTimeout(() => this.cache.delete(key), ttlMs ?? this.defaultTtlMs);
|
|
34
|
+
this.timers.set(key, timer);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
delete(key) {
|
|
38
|
+
clearTimeout(this.timers.get(key));
|
|
39
|
+
this.cache.delete(key);
|
|
40
|
+
}
|
|
41
|
+
clear() {
|
|
42
|
+
for (const key of this.timers.keys()) {
|
|
43
|
+
clearTimeout(this.timers.get(key));
|
|
44
|
+
}
|
|
45
|
+
this.cache.clear();
|
|
46
|
+
this.timers.clear();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.LocalCache = LocalCache;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Success<T> = {
|
|
2
|
+
data: T;
|
|
3
|
+
error: null;
|
|
4
|
+
};
|
|
5
|
+
type Failure<E> = {
|
|
6
|
+
data: null;
|
|
7
|
+
error: E;
|
|
8
|
+
};
|
|
9
|
+
type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
10
|
+
export declare function tryCatch<T, E = Error>(promise: Promise<T>): Promise<Result<T, E>>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=try-catch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"try-catch.d.ts","sourceRoot":"","sources":["../../src/utils/try-catch.ts"],"names":[],"mappings":"AACA,KAAK,OAAO,CAAC,CAAC,IAAI;IAChB,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,KAAK,OAAO,CAAC,CAAC,IAAI;IAChB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,CAAC,CAAA;CACT,CAAA;AAED,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAGnD,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EACzC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAOvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryCatch = tryCatch;
|
|
4
|
+
// Main wrapper function
|
|
5
|
+
async function tryCatch(promise) {
|
|
6
|
+
try {
|
|
7
|
+
const data = await promise;
|
|
8
|
+
return { data, error: null };
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return { data: null, error: error };
|
|
12
|
+
}
|
|
13
|
+
}
|