@flowcore/sdk 1.20.0 → 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 +16 -0
- package/esm/commands/data-core/data-core.request-delete.d.ts +5 -1
- package/esm/commands/data-core/data-core.request-delete.d.ts.map +1 -1
- package/esm/commands/data-core/data-core.request-delete.js +3 -6
- 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 +5 -1
- package/esm/commands/event-type/event-type.request-delete.d.ts.map +1 -1
- package/esm/commands/event-type/event-type.request-delete.js +3 -6
- package/esm/commands/event-type/event-type.request-truncate.d.ts +5 -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 +3 -6
- package/esm/commands/events/event.list.d.ts +5 -1
- package/esm/commands/events/event.list.d.ts.map +1 -1
- package/esm/commands/events/event.list.js +3 -6
- package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts +3 -1
- 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 +3 -6
- package/esm/commands/events/events.fetch.d.ts +3 -1
- package/esm/commands/events/events.fetch.d.ts.map +1 -1
- package/esm/commands/events/events.fetch.js +3 -6
- package/esm/commands/events/time-bucket.list.d.ts +5 -1
- package/esm/commands/events/time-bucket.list.d.ts.map +1 -1
- package/esm/commands/events/time-bucket.list.js +3 -6
- package/esm/commands/flow-type/flow-type.delete-request.d.ts +0 -2
- package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
- package/esm/commands/flow-type/flow-type.request-delete.d.ts +5 -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 +3 -6
- 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-custom.d.ts +0 -2
- package/esm/common/command-custom.d.ts.map +1 -1
- package/esm/common/command.d.ts +9 -5
- package/esm/common/command.d.ts.map +1 -1
- package/esm/common/command.js +33 -11
- package/esm/common/flowcore-client.d.ts +5 -6
- package/esm/common/flowcore-client.d.ts.map +1 -1
- package/esm/common/flowcore-client.js +20 -35
- 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 -2
- package/script/commands/data-core/data-core.request-delete.d.ts +5 -1
- package/script/commands/data-core/data-core.request-delete.d.ts.map +1 -1
- package/script/commands/data-core/data-core.request-delete.js +3 -6
- 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 +5 -1
- package/script/commands/event-type/event-type.request-delete.d.ts.map +1 -1
- package/script/commands/event-type/event-type.request-delete.js +3 -6
- package/script/commands/event-type/event-type.request-truncate.d.ts +5 -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 +3 -6
- package/script/commands/events/event.list.d.ts +5 -1
- package/script/commands/events/event.list.d.ts.map +1 -1
- package/script/commands/events/event.list.js +3 -6
- package/script/commands/events/events.fetch-time-buckets-by-names.d.ts +3 -1
- 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 +3 -6
- package/script/commands/events/events.fetch.d.ts +3 -1
- package/script/commands/events/events.fetch.d.ts.map +1 -1
- package/script/commands/events/events.fetch.js +3 -6
- package/script/commands/events/time-bucket.list.d.ts +5 -1
- package/script/commands/events/time-bucket.list.d.ts.map +1 -1
- package/script/commands/events/time-bucket.list.js +3 -6
- package/script/commands/flow-type/flow-type.delete-request.d.ts +0 -2
- package/script/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
- package/script/commands/flow-type/flow-type.request-delete.d.ts +5 -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 +3 -6
- 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-custom.d.ts +0 -2
- package/script/common/command-custom.d.ts.map +1 -1
- package/script/common/command.d.ts +9 -5
- package/script/common/command.d.ts.map +1 -1
- package/script/common/command.js +33 -11
- package/script/common/flowcore-client.d.ts +5 -6
- package/script/common/flowcore-client.d.ts.map +1 -1
- package/script/common/flowcore-client.js +20 -38
- 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
|
@@ -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
|
+
}
|