@croct/sdk 0.17.12 → 0.18.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/README.md +13 -15
- package/activeRecord.cjs +1 -1
- package/activeRecord.d.cts +26 -0
- package/activeRecord.js +1 -1
- package/apiKey.d.cts +48 -0
- package/base64Url.d.cts +4 -0
- package/cache/cache.d.cts +17 -0
- package/cache/cookieCache.d.cts +22 -0
- package/cache/fallbackCache.d.cts +11 -0
- package/cache/inMemoryCache.d.cts +11 -0
- package/cache/index.cjs +5 -5
- package/cache/index.d.cts +4 -0
- package/cache/index.js +4 -4
- package/cache/localStorageCache.d.cts +19 -0
- package/channel/channel.cjs +1 -1
- package/channel/channel.d.cts +24 -0
- package/channel/channel.js +1 -1
- package/channel/encodedChannel.d.cts +12 -0
- package/channel/guaranteedChannel.cjs +2 -2
- package/channel/guaranteedChannel.d.cts +33 -0
- package/channel/guaranteedChannel.js +2 -2
- package/channel/httpBeaconChannel.cjs +5 -5
- package/channel/httpBeaconChannel.d.cts +26 -0
- package/channel/httpBeaconChannel.js +5 -5
- package/channel/index.cjs +8 -8
- package/channel/index.d.cts +12 -0
- package/channel/index.js +7 -7
- package/channel/queuedChannel.cjs +7 -3
- package/channel/queuedChannel.d.cts +21 -0
- package/channel/queuedChannel.js +7 -3
- package/channel/retryChannel.cjs +2 -2
- package/channel/retryChannel.d.cts +21 -0
- package/channel/retryChannel.js +2 -2
- package/channel/sandboxChannel.cjs +1 -1
- package/channel/sandboxChannel.d.cts +15 -0
- package/channel/sandboxChannel.js +1 -1
- package/cid/assigner.d.cts +5 -0
- package/cid/cachedAssigner.cjs +1 -1
- package/cid/cachedAssigner.d.cts +17 -0
- package/cid/cachedAssigner.js +1 -1
- package/cid/fixedAssigner.d.cts +9 -0
- package/cid/index.cjs +5 -5
- package/cid/index.d.cts +6 -0
- package/cid/index.js +4 -4
- package/cid/remoteAssigner.cjs +3 -3
- package/cid/remoteAssigner.d.cts +13 -0
- package/cid/remoteAssigner.js +3 -3
- package/constants.cjs +1 -1
- package/constants.d.cts +6 -0
- package/constants.d.ts +2 -2
- package/constants.js +1 -1
- package/container.cjs +18 -18
- package/container.d.cts +95 -0
- package/container.js +18 -18
- package/contentFetcher.cjs +4 -4
- package/contentFetcher.d.cts +69 -0
- package/contentFetcher.js +4 -4
- package/context.cjs +4 -4
- package/context.d.cts +36 -0
- package/context.js +4 -4
- package/error.d.cts +4 -0
- package/evaluator.cjs +5 -5
- package/evaluator.d.cts +86 -0
- package/evaluator.js +5 -5
- package/eventManager.d.cts +21 -0
- package/eventSubjectProcessor.d.cts +22 -0
- package/facade/contentFetcherFacade.cjs +2 -2
- package/facade/contentFetcherFacade.d.cts +36 -0
- package/facade/contentFetcherFacade.js +2 -2
- package/facade/evaluatorFacade.cjs +2 -2
- package/facade/evaluatorFacade.d.cts +41 -0
- package/facade/evaluatorFacade.js +2 -2
- package/facade/index.cjs +7 -9
- package/facade/index.d.cts +29 -0
- package/facade/index.js +7 -8
- package/facade/sdkFacade.cjs +10 -10
- package/facade/sdkFacade.d.cts +86 -0
- package/facade/sdkFacade.js +10 -10
- package/facade/sessionFacade.cjs +1 -1
- package/facade/sessionFacade.d.cts +22 -0
- package/facade/sessionFacade.js +1 -1
- package/facade/sessionPatch.cjs +1 -1
- package/facade/sessionPatch.d.cts +21 -0
- package/facade/sessionPatch.js +1 -1
- package/facade/trackerFacade.cjs +2 -2
- package/facade/trackerFacade.d.cts +25 -0
- package/facade/trackerFacade.js +2 -2
- package/facade/userFacade.cjs +1 -1
- package/facade/userFacade.d.cts +28 -0
- package/facade/userFacade.js +1 -1
- package/facade/userPatch.cjs +1 -1
- package/facade/userPatch.d.cts +21 -0
- package/facade/userPatch.js +1 -1
- package/help.d.cts +5 -0
- package/index.cjs +2 -4
- package/index.d.cts +25 -0
- package/index.js +2 -3
- package/logging/consoleLogger.d.cts +13 -0
- package/logging/filteredLogger.d.cts +22 -0
- package/logging/index.cjs +6 -6
- package/logging/index.d.cts +5 -0
- package/logging/index.js +5 -5
- package/logging/logger.d.cts +11 -0
- package/logging/namespacedLogger.d.cts +14 -0
- package/logging/nullLogger.d.cts +10 -0
- package/namespacedStorage.d.cts +16 -0
- package/package.json +4 -1
- package/patch.d.cts +46 -0
- package/queue/capacityRestrictedQueue.d.cts +16 -0
- package/queue/inMemoryQueue.d.cts +15 -0
- package/queue/index.cjs +6 -6
- package/queue/index.d.cts +6 -0
- package/queue/index.js +5 -5
- package/queue/monitoredQueue.cjs +1 -1
- package/queue/monitoredQueue.d.cts +28 -0
- package/queue/monitoredQueue.js +1 -1
- package/queue/persistentQueue.d.cts +18 -0
- package/queue/queue.d.cts +11 -0
- package/retry/arbitraryPolicy.d.cts +10 -0
- package/retry/backoffPolicy.d.cts +26 -0
- package/retry/index.cjs +6 -6
- package/retry/index.d.cts +5 -0
- package/retry/index.js +5 -5
- package/retry/maxAttemptsPolicy.d.cts +11 -0
- package/retry/neverPolicy.d.cts +8 -0
- package/retry/policy.d.cts +6 -0
- package/schema/attributeSchema.cjs +1 -1
- package/schema/attributeSchema.d.cts +6 -0
- package/schema/attributeSchema.js +1 -1
- package/schema/contentFetcherSchemas.cjs +1 -1
- package/schema/contentFetcherSchemas.d.cts +6 -0
- package/schema/contentFetcherSchemas.js +1 -1
- package/schema/contentSchemas.cjs +1 -1
- package/schema/contentSchemas.d.cts +6 -0
- package/schema/contentSchemas.js +1 -1
- package/schema/contextSchemas.cjs +1 -1
- package/schema/contextSchemas.d.cts +6 -0
- package/schema/contextSchemas.js +1 -1
- package/schema/ecommerceSchemas.cjs +1 -1
- package/schema/ecommerceSchemas.d.cts +10 -0
- package/schema/ecommerceSchemas.js +1 -1
- package/schema/evaluatorSchemas.cjs +1 -1
- package/schema/evaluatorSchemas.d.cts +6 -0
- package/schema/evaluatorSchemas.js +1 -1
- package/schema/eventSchemas.cjs +4 -4
- package/schema/eventSchemas.d.cts +16 -0
- package/schema/eventSchemas.js +4 -4
- package/schema/index.cjs +22 -22
- package/schema/index.d.cts +14 -0
- package/schema/index.js +11 -11
- package/schema/loggerSchema.cjs +1 -1
- package/schema/loggerSchema.d.cts +6 -0
- package/schema/loggerSchema.js +1 -1
- package/schema/operationSchemas.cjs +2 -2
- package/schema/operationSchemas.d.cts +14 -0
- package/schema/operationSchemas.js +2 -2
- package/schema/sdkFacadeSchemas.cjs +4 -4
- package/schema/sdkFacadeSchemas.d.cts +6 -0
- package/schema/sdkFacadeSchemas.js +4 -4
- package/schema/sdkSchemas.cjs +3 -3
- package/schema/sdkSchemas.d.cts +8 -0
- package/schema/sdkSchemas.js +3 -3
- package/schema/tokenSchema.cjs +1 -1
- package/schema/tokenSchema.d.cts +6 -0
- package/schema/tokenSchema.js +1 -1
- package/schema/userSchema.cjs +2 -2
- package/schema/userSchema.d.cts +6 -0
- package/schema/userSchema.js +2 -2
- package/sdk.cjs +4 -4
- package/sdk.d.cts +69 -0
- package/sdk.js +4 -4
- package/sdkEvents.d.cts +15 -0
- package/sourceLocation.d.cts +14 -0
- package/tab.cjs +1 -1
- package/tab.d.cts +40 -0
- package/tab.js +1 -1
- package/token/cachedTokenStore.cjs +1 -1
- package/token/cachedTokenStore.d.cts +13 -0
- package/token/cachedTokenStore.js +1 -1
- package/token/inMemoryTokenStore.d.cts +11 -0
- package/token/index.cjs +5 -5
- package/token/index.d.cts +7 -0
- package/token/index.js +4 -4
- package/token/replicatedTokenStore.d.cts +13 -0
- package/token/token.cjs +3 -3
- package/token/token.d.cts +70 -0
- package/token/token.js +3 -3
- package/tracker.cjs +3 -3
- package/tracker.d.cts +82 -0
- package/tracker.js +3 -3
- package/trackingEvents.d.cts +309 -0
- package/transformer.d.cts +6 -0
- package/utilityTypes.d.cts +4 -0
- package/uuid.d.cts +3 -0
- package/validation/arrayType.cjs +2 -2
- package/validation/arrayType.d.cts +16 -0
- package/validation/arrayType.js +2 -2
- package/validation/booleanType.cjs +2 -2
- package/validation/booleanType.d.cts +9 -0
- package/validation/booleanType.js +2 -2
- package/validation/functionType.cjs +2 -2
- package/validation/functionType.d.cts +9 -0
- package/validation/functionType.js +2 -2
- package/validation/index.cjs +14 -14
- package/validation/index.d.cts +12 -0
- package/validation/index.js +12 -12
- package/validation/jsonType.cjs +2 -2
- package/validation/jsonType.d.cts +35 -0
- package/validation/jsonType.js +2 -2
- package/validation/mixedSchema.d.cts +7 -0
- package/validation/nullType.cjs +2 -2
- package/validation/nullType.d.cts +9 -0
- package/validation/nullType.js +2 -2
- package/validation/numberType.cjs +2 -2
- package/validation/numberType.d.cts +16 -0
- package/validation/numberType.js +2 -2
- package/validation/objectType.cjs +3 -3
- package/validation/objectType.d.cts +30 -0
- package/validation/objectType.js +3 -3
- package/validation/schema.d.cts +18 -0
- package/validation/stringType.cjs +2 -2
- package/validation/stringType.d.cts +24 -0
- package/validation/stringType.js +2 -2
- package/validation/unionType.cjs +2 -2
- package/validation/unionType.d.cts +11 -0
- package/validation/unionType.js +2 -2
- package/validation/violation.d.cts +4 -0
package/index.cjs
CHANGED
|
@@ -17,16 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var index_exports = {};
|
|
19
19
|
__export(index_exports, {
|
|
20
|
-
Configuration: () => import_sdk.Configuration,
|
|
21
20
|
Sdk: () => import_sdk.Sdk,
|
|
22
21
|
VERSION: () => import_constants.VERSION
|
|
23
22
|
});
|
|
24
23
|
module.exports = __toCommonJS(index_exports);
|
|
25
|
-
var import_constants = require(
|
|
26
|
-
var import_sdk = require(
|
|
24
|
+
var import_constants = require('./constants.cjs');
|
|
25
|
+
var import_sdk = require('./sdk.cjs');
|
|
27
26
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
27
|
0 && (module.exports = {
|
|
29
|
-
Configuration,
|
|
30
28
|
Sdk,
|
|
31
29
|
VERSION
|
|
32
30
|
});
|
package/index.d.cts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { VERSION } from './constants.cjs';
|
|
2
|
+
export { Configuration, Sdk } from './sdk.cjs';
|
|
3
|
+
import './container.cjs';
|
|
4
|
+
import './logging/logger.cjs';
|
|
5
|
+
import './context.cjs';
|
|
6
|
+
import './token/token.cjs';
|
|
7
|
+
import '@croct/json';
|
|
8
|
+
import './apiKey.cjs';
|
|
9
|
+
import './cache/cache.cjs';
|
|
10
|
+
import './tab.cjs';
|
|
11
|
+
import './eventManager.cjs';
|
|
12
|
+
import './sdkEvents.cjs';
|
|
13
|
+
import './queue/monitoredQueue.cjs';
|
|
14
|
+
import './queue/queue.cjs';
|
|
15
|
+
import './tracker.cjs';
|
|
16
|
+
import './channel/channel.cjs';
|
|
17
|
+
import './retry/policy.cjs';
|
|
18
|
+
import './trackingEvents.cjs';
|
|
19
|
+
import './patch.cjs';
|
|
20
|
+
import './utilityTypes.cjs';
|
|
21
|
+
import './evaluator.cjs';
|
|
22
|
+
import './sourceLocation.cjs';
|
|
23
|
+
import './cid/assigner.cjs';
|
|
24
|
+
import './contentFetcher.cjs';
|
|
25
|
+
import './cache/cookieCache.cjs';
|
package/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Logger } from './logger.cjs';
|
|
2
|
+
|
|
3
|
+
declare class ConsoleLogger implements Logger {
|
|
4
|
+
private readonly namespace?;
|
|
5
|
+
constructor(namespace?: string);
|
|
6
|
+
get debug(): (message: string) => void;
|
|
7
|
+
get info(): (message: string) => void;
|
|
8
|
+
get warn(): (message: string) => void;
|
|
9
|
+
get error(): (message: string) => void;
|
|
10
|
+
private bind;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ConsoleLogger };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Logger } from './logger.cjs';
|
|
2
|
+
|
|
3
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
4
|
+
type LogFilter = (level: LogLevel, message: string) => boolean;
|
|
5
|
+
type FilteredLoggerConfiguration = {
|
|
6
|
+
logger: Logger;
|
|
7
|
+
allowFilter: LogFilter;
|
|
8
|
+
};
|
|
9
|
+
declare class FilteredLogger implements Logger {
|
|
10
|
+
private readonly logger;
|
|
11
|
+
private readonly allowFilter;
|
|
12
|
+
constructor(configuration: FilteredLoggerConfiguration);
|
|
13
|
+
static include(logger: Logger, levels: LogLevel[]): Logger;
|
|
14
|
+
static exclude(logger: Logger, levels: LogLevel[]): FilteredLogger;
|
|
15
|
+
debug(message: string): void;
|
|
16
|
+
info(message: string): void;
|
|
17
|
+
warn(message: string): void;
|
|
18
|
+
error(message: string): void;
|
|
19
|
+
private log;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { FilteredLogger, type FilteredLoggerConfiguration, type LogFilter, type LogLevel };
|
package/logging/index.cjs
CHANGED
|
@@ -24,16 +24,16 @@ __export(logging_exports, {
|
|
|
24
24
|
NullLogger: () => import_nullLogger.NullLogger
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(logging_exports);
|
|
27
|
-
__reExport(logging_exports, require(
|
|
28
|
-
var import_consoleLogger = require(
|
|
29
|
-
var import_namespacedLogger = require(
|
|
30
|
-
var import_nullLogger = require(
|
|
31
|
-
var import_filteredLogger = require(
|
|
27
|
+
__reExport(logging_exports, require('./logger.cjs'), module.exports);
|
|
28
|
+
var import_consoleLogger = require('./consoleLogger.cjs');
|
|
29
|
+
var import_namespacedLogger = require('./namespacedLogger.cjs');
|
|
30
|
+
var import_nullLogger = require('./nullLogger.cjs');
|
|
31
|
+
var import_filteredLogger = require('./filteredLogger.cjs');
|
|
32
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
33
|
0 && (module.exports = {
|
|
34
34
|
ConsoleLogger,
|
|
35
35
|
FilteredLogger,
|
|
36
36
|
NamespacedLogger,
|
|
37
37
|
NullLogger,
|
|
38
|
-
...require(
|
|
38
|
+
...require('./logger.cjs')
|
|
39
39
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Logger, LoggerFactory } from './logger.cjs';
|
|
2
|
+
export { ConsoleLogger } from './consoleLogger.cjs';
|
|
3
|
+
export { NamespacedLogger } from './namespacedLogger.cjs';
|
|
4
|
+
export { NullLogger } from './nullLogger.cjs';
|
|
5
|
+
export { FilteredLogger } from './filteredLogger.cjs';
|
package/logging/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./logger";
|
|
2
|
-
import { ConsoleLogger } from "./consoleLogger";
|
|
3
|
-
import { NamespacedLogger } from "./namespacedLogger";
|
|
4
|
-
import { NullLogger } from "./nullLogger";
|
|
5
|
-
import { FilteredLogger } from "./filteredLogger";
|
|
1
|
+
export * from "./logger.js";
|
|
2
|
+
import { ConsoleLogger } from "./consoleLogger.js";
|
|
3
|
+
import { NamespacedLogger } from "./namespacedLogger.js";
|
|
4
|
+
import { NullLogger } from "./nullLogger.js";
|
|
5
|
+
import { FilteredLogger } from "./filteredLogger.js";
|
|
6
6
|
export {
|
|
7
7
|
ConsoleLogger,
|
|
8
8
|
FilteredLogger,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Logger } from './logger.cjs';
|
|
2
|
+
|
|
3
|
+
declare class NamespacedLogger implements Logger {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private readonly namespace;
|
|
6
|
+
constructor(logger: Logger, namespace: string);
|
|
7
|
+
debug(message: string): void;
|
|
8
|
+
info(message: string): void;
|
|
9
|
+
warn(message: string): void;
|
|
10
|
+
error(message: string): void;
|
|
11
|
+
private format;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { NamespacedLogger };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare class NamespacedStorage implements Storage {
|
|
2
|
+
private readonly storage;
|
|
3
|
+
private readonly namespace;
|
|
4
|
+
constructor(storage: Storage, namespace: string);
|
|
5
|
+
get length(): number;
|
|
6
|
+
clear(): void;
|
|
7
|
+
getItem(key: string): string | null;
|
|
8
|
+
key(index: number): string | null;
|
|
9
|
+
removeItem(key: string): void;
|
|
10
|
+
setItem(key: string, value: string): void;
|
|
11
|
+
private getKeys;
|
|
12
|
+
private getPrefixedKey;
|
|
13
|
+
private getPrefix;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { NamespacedStorage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@croct/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Croct SDK for JavaScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"tslib": "^2.5.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
+
"esbuild-fix-imports-plugin": "^1.0.19",
|
|
87
88
|
"@croct/eslint-plugin": "^0.7.0",
|
|
88
89
|
"@types/jest": "^29.2.3",
|
|
89
90
|
"eslint": "^8.57.0",
|
|
@@ -101,6 +102,8 @@
|
|
|
101
102
|
"**/*.cjs",
|
|
102
103
|
"**/*.mjs",
|
|
103
104
|
"**/*.ts",
|
|
105
|
+
"**/*.mts",
|
|
106
|
+
"**/*.cts",
|
|
104
107
|
"**/*.map"
|
|
105
108
|
],
|
|
106
109
|
"browserslist": [
|
package/patch.d.cts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { JsonValue, JsonStructure } from '@croct/json';
|
|
2
|
+
|
|
3
|
+
interface AbstractOperation {
|
|
4
|
+
type: string;
|
|
5
|
+
path: string;
|
|
6
|
+
}
|
|
7
|
+
interface UnsetOperation extends AbstractOperation {
|
|
8
|
+
type: 'unset';
|
|
9
|
+
}
|
|
10
|
+
interface ClearOperation extends AbstractOperation {
|
|
11
|
+
type: 'clear';
|
|
12
|
+
}
|
|
13
|
+
interface SetOperation extends AbstractOperation {
|
|
14
|
+
type: 'set';
|
|
15
|
+
value: JsonValue;
|
|
16
|
+
}
|
|
17
|
+
interface AddOperation extends AbstractOperation {
|
|
18
|
+
type: 'add';
|
|
19
|
+
value: JsonValue;
|
|
20
|
+
}
|
|
21
|
+
interface CombineOperation extends AbstractOperation {
|
|
22
|
+
type: 'combine';
|
|
23
|
+
value: JsonValue;
|
|
24
|
+
}
|
|
25
|
+
interface MergeOperation extends AbstractOperation {
|
|
26
|
+
type: 'merge';
|
|
27
|
+
value: JsonStructure;
|
|
28
|
+
}
|
|
29
|
+
interface IncrementOperation extends AbstractOperation {
|
|
30
|
+
type: 'increment';
|
|
31
|
+
value: JsonValue;
|
|
32
|
+
}
|
|
33
|
+
interface DecrementOperation extends AbstractOperation {
|
|
34
|
+
type: 'decrement';
|
|
35
|
+
value: JsonValue;
|
|
36
|
+
}
|
|
37
|
+
interface removeOperation extends AbstractOperation {
|
|
38
|
+
type: 'remove';
|
|
39
|
+
value: JsonValue;
|
|
40
|
+
}
|
|
41
|
+
type Operation = UnsetOperation | ClearOperation | AddOperation | SetOperation | CombineOperation | MergeOperation | IncrementOperation | DecrementOperation | removeOperation;
|
|
42
|
+
interface Patch {
|
|
43
|
+
operations: Operation[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type { Operation, Patch };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Queue } from './queue.cjs';
|
|
2
|
+
|
|
3
|
+
declare class CapacityRestrictedQueue<T> implements Queue<T> {
|
|
4
|
+
private readonly queue;
|
|
5
|
+
private readonly capacity;
|
|
6
|
+
constructor(queue: Queue<T>, capacity: number);
|
|
7
|
+
all(): T[];
|
|
8
|
+
getCapacity(): number;
|
|
9
|
+
isEmpty(): boolean;
|
|
10
|
+
length(): number;
|
|
11
|
+
peek(): T | null;
|
|
12
|
+
push(value: T): void;
|
|
13
|
+
shift(): T;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { CapacityRestrictedQueue };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Queue } from './queue.cjs';
|
|
2
|
+
|
|
3
|
+
declare class InMemoryQueue<T> implements Queue<T> {
|
|
4
|
+
private queue;
|
|
5
|
+
constructor(...values: T[]);
|
|
6
|
+
all(): T[];
|
|
7
|
+
getCapacity(): number;
|
|
8
|
+
isEmpty(): boolean;
|
|
9
|
+
push(value: T): void;
|
|
10
|
+
peek(): T | null;
|
|
11
|
+
shift(): T;
|
|
12
|
+
length(): number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { InMemoryQueue };
|
package/queue/index.cjs
CHANGED
|
@@ -24,16 +24,16 @@ __export(queue_exports, {
|
|
|
24
24
|
PersistentQueue: () => import_persistentQueue.PersistentQueue
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(queue_exports);
|
|
27
|
-
__reExport(queue_exports, require(
|
|
28
|
-
var import_capacityRestrictedQueue = require(
|
|
29
|
-
var import_inMemoryQueue = require(
|
|
30
|
-
var import_monitoredQueue = require(
|
|
31
|
-
var import_persistentQueue = require(
|
|
27
|
+
__reExport(queue_exports, require('./queue.cjs'), module.exports);
|
|
28
|
+
var import_capacityRestrictedQueue = require('./capacityRestrictedQueue.cjs');
|
|
29
|
+
var import_inMemoryQueue = require('./inMemoryQueue.cjs');
|
|
30
|
+
var import_monitoredQueue = require('./monitoredQueue.cjs');
|
|
31
|
+
var import_persistentQueue = require('./persistentQueue.cjs');
|
|
32
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
33
|
0 && (module.exports = {
|
|
34
34
|
CapacityRestrictedQueue,
|
|
35
35
|
InMemoryQueue,
|
|
36
36
|
MonitoredQueue,
|
|
37
37
|
PersistentQueue,
|
|
38
|
-
...require(
|
|
38
|
+
...require('./queue.cjs')
|
|
39
39
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Queue } from './queue.cjs';
|
|
2
|
+
export { CapacityRestrictedQueue } from './capacityRestrictedQueue.cjs';
|
|
3
|
+
export { InMemoryQueue } from './inMemoryQueue.cjs';
|
|
4
|
+
export { MonitoredQueue } from './monitoredQueue.cjs';
|
|
5
|
+
export { PersistentQueue } from './persistentQueue.cjs';
|
|
6
|
+
import '../logging/logger.cjs';
|
package/queue/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./queue";
|
|
2
|
-
import { CapacityRestrictedQueue } from "./capacityRestrictedQueue";
|
|
3
|
-
import { InMemoryQueue } from "./inMemoryQueue";
|
|
4
|
-
import { MonitoredQueue } from "./monitoredQueue";
|
|
5
|
-
import { PersistentQueue } from "./persistentQueue";
|
|
1
|
+
export * from "./queue.js";
|
|
2
|
+
import { CapacityRestrictedQueue } from "./capacityRestrictedQueue.js";
|
|
3
|
+
import { InMemoryQueue } from "./inMemoryQueue.js";
|
|
4
|
+
import { MonitoredQueue } from "./monitoredQueue.js";
|
|
5
|
+
import { PersistentQueue } from "./persistentQueue.js";
|
|
6
6
|
export {
|
|
7
7
|
CapacityRestrictedQueue,
|
|
8
8
|
InMemoryQueue,
|
package/queue/monitoredQueue.cjs
CHANGED
|
@@ -20,7 +20,7 @@ __export(monitoredQueue_exports, {
|
|
|
20
20
|
MonitoredQueue: () => MonitoredQueue
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(monitoredQueue_exports);
|
|
23
|
-
var import_logging = require(
|
|
23
|
+
var import_logging = require('../logging/index.cjs');
|
|
24
24
|
class MonitoredQueue {
|
|
25
25
|
constructor(queue, logger) {
|
|
26
26
|
this.callbacks = {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Queue } from './queue.cjs';
|
|
2
|
+
import { Logger } from '../logging/logger.cjs';
|
|
3
|
+
|
|
4
|
+
type QueueStatus = 'halfEmpty' | 'almostEmpty' | 'empty' | 'halfFull' | 'almostFull' | 'full';
|
|
5
|
+
type QueueCallback<T> = {
|
|
6
|
+
(queue: Queue<T>): void;
|
|
7
|
+
};
|
|
8
|
+
declare class MonitoredQueue<T> implements Queue<T> {
|
|
9
|
+
private readonly queue;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
private readonly callbacks;
|
|
12
|
+
private status;
|
|
13
|
+
constructor(queue: Queue<T>, logger?: Logger);
|
|
14
|
+
all(): T[];
|
|
15
|
+
getCapacity(): number;
|
|
16
|
+
addCallback(status: QueueStatus, callback: QueueCallback<T>): void;
|
|
17
|
+
removeCallback(type: QueueStatus, callback: QueueCallback<T>): void;
|
|
18
|
+
private setStatus;
|
|
19
|
+
private report;
|
|
20
|
+
isEmpty(): boolean;
|
|
21
|
+
length(): number;
|
|
22
|
+
peek(): T | null;
|
|
23
|
+
push(value: T): void;
|
|
24
|
+
shift(): T;
|
|
25
|
+
private updateStatus;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { MonitoredQueue, type QueueCallback, type QueueStatus };
|
package/queue/monitoredQueue.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Queue } from './queue.cjs';
|
|
2
|
+
|
|
3
|
+
declare class PersistentQueue<T> implements Queue<T> {
|
|
4
|
+
private readonly storage;
|
|
5
|
+
private readonly key;
|
|
6
|
+
constructor(storage: Storage, key?: string);
|
|
7
|
+
all(): T[];
|
|
8
|
+
getCapacity(): number;
|
|
9
|
+
isEmpty(): boolean;
|
|
10
|
+
length(): number;
|
|
11
|
+
push(value: T): void;
|
|
12
|
+
peek(): T | null;
|
|
13
|
+
shift(): T;
|
|
14
|
+
private get queue();
|
|
15
|
+
private save;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { PersistentQueue };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RetryPolicy } from './policy.cjs';
|
|
2
|
+
|
|
3
|
+
declare class ArbitraryPolicy<T> implements RetryPolicy<T> {
|
|
4
|
+
private readonly delays;
|
|
5
|
+
constructor(delays: number[]);
|
|
6
|
+
getDelay(attempt: number): number;
|
|
7
|
+
shouldRetry(): boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { ArbitraryPolicy };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RetryPolicy } from './policy.cjs';
|
|
2
|
+
|
|
3
|
+
type Options = {
|
|
4
|
+
minRetryDelay: number;
|
|
5
|
+
maxRetryDelay: number;
|
|
6
|
+
backoffFactor: number;
|
|
7
|
+
backoffJitter: number;
|
|
8
|
+
maxAttempts: number;
|
|
9
|
+
};
|
|
10
|
+
declare class BackoffPolicy<T> implements RetryPolicy<T> {
|
|
11
|
+
private readonly minRetryDelay;
|
|
12
|
+
private readonly maxRetryDelay;
|
|
13
|
+
private readonly backoffFactor;
|
|
14
|
+
private readonly backoffJitter;
|
|
15
|
+
private readonly maxAttempts;
|
|
16
|
+
constructor(options?: Partial<Options>);
|
|
17
|
+
/**
|
|
18
|
+
* Full Jitter algorithm
|
|
19
|
+
*
|
|
20
|
+
* @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
|
21
|
+
*/
|
|
22
|
+
getDelay(attempt: number): number;
|
|
23
|
+
shouldRetry(attempt: number): boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { BackoffPolicy };
|
package/retry/index.cjs
CHANGED
|
@@ -24,16 +24,16 @@ __export(retry_exports, {
|
|
|
24
24
|
NeverPolicy: () => import_neverPolicy.NeverPolicy
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(retry_exports);
|
|
27
|
-
__reExport(retry_exports, require(
|
|
28
|
-
var import_arbitraryPolicy = require(
|
|
29
|
-
var import_backoffPolicy = require(
|
|
30
|
-
var import_maxAttemptsPolicy = require(
|
|
31
|
-
var import_neverPolicy = require(
|
|
27
|
+
__reExport(retry_exports, require('./policy.cjs'), module.exports);
|
|
28
|
+
var import_arbitraryPolicy = require('./arbitraryPolicy.cjs');
|
|
29
|
+
var import_backoffPolicy = require('./backoffPolicy.cjs');
|
|
30
|
+
var import_maxAttemptsPolicy = require('./maxAttemptsPolicy.cjs');
|
|
31
|
+
var import_neverPolicy = require('./neverPolicy.cjs');
|
|
32
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
33
|
0 && (module.exports = {
|
|
34
34
|
ArbitraryPolicy,
|
|
35
35
|
BackoffPolicy,
|
|
36
36
|
MaxAttemptsPolicy,
|
|
37
37
|
NeverPolicy,
|
|
38
|
-
...require(
|
|
38
|
+
...require('./policy.cjs')
|
|
39
39
|
});
|
package/retry/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./policy";
|
|
2
|
-
import { ArbitraryPolicy } from "./arbitraryPolicy";
|
|
3
|
-
import { BackoffPolicy } from "./backoffPolicy";
|
|
4
|
-
import { MaxAttemptsPolicy } from "./maxAttemptsPolicy";
|
|
5
|
-
import { NeverPolicy } from "./neverPolicy";
|
|
1
|
+
export * from "./policy.js";
|
|
2
|
+
import { ArbitraryPolicy } from "./arbitraryPolicy.js";
|
|
3
|
+
import { BackoffPolicy } from "./backoffPolicy.js";
|
|
4
|
+
import { MaxAttemptsPolicy } from "./maxAttemptsPolicy.js";
|
|
5
|
+
import { NeverPolicy } from "./neverPolicy.js";
|
|
6
6
|
export {
|
|
7
7
|
ArbitraryPolicy,
|
|
8
8
|
BackoffPolicy,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RetryPolicy } from './policy.cjs';
|
|
2
|
+
|
|
3
|
+
declare class MaxAttemptsPolicy<T> implements RetryPolicy<T> {
|
|
4
|
+
private readonly maxAttempts;
|
|
5
|
+
private readonly delay;
|
|
6
|
+
constructor(delay: number, maxAttempts: number);
|
|
7
|
+
getDelay(): number;
|
|
8
|
+
shouldRetry(attempt: number): boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { MaxAttemptsPolicy };
|
|
@@ -20,7 +20,7 @@ __export(attributeSchema_exports, {
|
|
|
20
20
|
attributeNameSchema: () => attributeNameSchema
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(attributeSchema_exports);
|
|
23
|
-
var import_validation = require(
|
|
23
|
+
var import_validation = require('../validation/index.cjs');
|
|
24
24
|
const attributeNameSchema = new import_validation.StringType({
|
|
25
25
|
maxLength: 50,
|
|
26
26
|
format: "identifier"
|
|
@@ -20,7 +20,7 @@ __export(contentFetcherSchemas_exports, {
|
|
|
20
20
|
fetchOptionsSchema: () => fetchOptionsSchema
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(contentFetcherSchemas_exports);
|
|
23
|
-
var import_validation = require(
|
|
23
|
+
var import_validation = require('../validation/index.cjs');
|
|
24
24
|
const fetchOptionsSchema = new import_validation.ObjectType({
|
|
25
25
|
properties: {
|
|
26
26
|
timeout: new import_validation.NumberType({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ObjectType, NumberType, JsonObjectType, StringType, UnionType } from "../validation";
|
|
1
|
+
import { ObjectType, NumberType, JsonObjectType, StringType, UnionType } from "../validation/index.js";
|
|
2
2
|
const fetchOptionsSchema = new ObjectType({
|
|
3
3
|
properties: {
|
|
4
4
|
timeout: new NumberType({
|
|
@@ -20,7 +20,7 @@ __export(contentSchemas_exports, {
|
|
|
20
20
|
postDetails: () => postDetails
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(contentSchemas_exports);
|
|
23
|
-
var import_validation = require(
|
|
23
|
+
var import_validation = require('../validation/index.cjs');
|
|
24
24
|
const postDetails = new import_validation.ObjectType({
|
|
25
25
|
required: ["postId", "title", "publishTime"],
|
|
26
26
|
properties: {
|
package/schema/contentSchemas.js
CHANGED
|
@@ -20,7 +20,7 @@ __export(contextSchemas_exports, {
|
|
|
20
20
|
tokenScopeSchema: () => tokenScopeSchema
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(contextSchemas_exports);
|
|
23
|
-
var import_validation = require(
|
|
23
|
+
var import_validation = require('../validation/index.cjs');
|
|
24
24
|
const tokenScopeSchema = new import_validation.StringType({
|
|
25
25
|
enumeration: ["global", "contextual", "isolated"]
|
|
26
26
|
});
|
package/schema/contextSchemas.js
CHANGED