@launchdarkly/js-sdk-common 2.9.0 → 2.10.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 +9 -0
- package/dist/api/platform/Requests.d.ts +5 -0
- package/dist/api/platform/Requests.d.ts.map +1 -1
- package/dist/datasource/DataSourceErrorKinds.d.ts +7 -0
- package/dist/datasource/DataSourceErrorKinds.d.ts.map +1 -0
- package/dist/datasource/errors.d.ts +17 -0
- package/dist/datasource/errors.d.ts.map +1 -0
- package/dist/datasource/index.d.ts +4 -0
- package/dist/datasource/index.d.ts.map +1 -0
- package/dist/errors.d.ts +0 -11
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.cjs +2477 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2430 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/events/EventSender.d.ts.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/stream/StreamingProcessor.d.ts.map +1 -1
- package/dist/internal/stream/types.d.ts +1 -1
- package/dist/internal/stream/types.d.ts.map +1 -1
- package/package.json +18 -7
- package/dist/AttributeReference.js +0 -126
- package/dist/AttributeReference.js.map +0 -1
- package/dist/Context.js +0 -382
- package/dist/Context.js.map +0 -1
- package/dist/ContextFilter.js +0 -124
- package/dist/ContextFilter.js.map +0 -1
- package/dist/api/context/LDContext.js +0 -3
- package/dist/api/context/LDContext.js.map +0 -1
- package/dist/api/context/LDContextCommon.js +0 -3
- package/dist/api/context/LDContextCommon.js.map +0 -1
- package/dist/api/context/LDContextMeta.js +0 -3
- package/dist/api/context/LDContextMeta.js.map +0 -1
- package/dist/api/context/LDMultiKindContext.js +0 -3
- package/dist/api/context/LDMultiKindContext.js.map +0 -1
- package/dist/api/context/LDSingleKindContext.js +0 -3
- package/dist/api/context/LDSingleKindContext.js.map +0 -1
- package/dist/api/context/LDUser.js +0 -3
- package/dist/api/context/LDUser.js.map +0 -1
- package/dist/api/context/index.js +0 -23
- package/dist/api/context/index.js.map +0 -1
- package/dist/api/data/LDEvaluationDetail.js +0 -3
- package/dist/api/data/LDEvaluationDetail.js.map +0 -1
- package/dist/api/data/LDEvaluationReason.js +0 -3
- package/dist/api/data/LDEvaluationReason.js.map +0 -1
- package/dist/api/data/LDFlagSet.js +0 -3
- package/dist/api/data/LDFlagSet.js.map +0 -1
- package/dist/api/data/LDFlagValue.js +0 -3
- package/dist/api/data/LDFlagValue.js.map +0 -1
- package/dist/api/data/index.js +0 -21
- package/dist/api/data/index.js.map +0 -1
- package/dist/api/index.js +0 -24
- package/dist/api/index.js.map +0 -1
- package/dist/api/logging/BasicLoggerOptions.js +0 -3
- package/dist/api/logging/BasicLoggerOptions.js.map +0 -1
- package/dist/api/logging/LDLogLevel.js +0 -3
- package/dist/api/logging/LDLogLevel.js.map +0 -1
- package/dist/api/logging/LDLogger.js +0 -3
- package/dist/api/logging/LDLogger.js.map +0 -1
- package/dist/api/logging/index.js +0 -20
- package/dist/api/logging/index.js.map +0 -1
- package/dist/api/options/LDClientContext.js +0 -3
- package/dist/api/options/LDClientContext.js.map +0 -1
- package/dist/api/options/index.js +0 -4
- package/dist/api/options/index.js.map +0 -1
- package/dist/api/platform/AutoEnv.js +0 -20
- package/dist/api/platform/AutoEnv.js.map +0 -1
- package/dist/api/platform/Crypto.js +0 -3
- package/dist/api/platform/Crypto.js.map +0 -1
- package/dist/api/platform/Encoding.js +0 -3
- package/dist/api/platform/Encoding.js.map +0 -1
- package/dist/api/platform/EventSource.js +0 -3
- package/dist/api/platform/EventSource.js.map +0 -1
- package/dist/api/platform/Filesystem.js +0 -3
- package/dist/api/platform/Filesystem.js.map +0 -1
- package/dist/api/platform/Info.js +0 -3
- package/dist/api/platform/Info.js.map +0 -1
- package/dist/api/platform/Platform.js +0 -3
- package/dist/api/platform/Platform.js.map +0 -1
- package/dist/api/platform/Requests.js +0 -3
- package/dist/api/platform/Requests.js.map +0 -1
- package/dist/api/platform/Storage.js +0 -3
- package/dist/api/platform/Storage.js.map +0 -1
- package/dist/api/platform/index.js +0 -26
- package/dist/api/platform/index.js.map +0 -1
- package/dist/api/subsystem/LDContextDeduplicator.js +0 -3
- package/dist/api/subsystem/LDContextDeduplicator.js.map +0 -1
- package/dist/api/subsystem/LDEventProcessor.js +0 -3
- package/dist/api/subsystem/LDEventProcessor.js.map +0 -1
- package/dist/api/subsystem/LDEventSender.js +0 -15
- package/dist/api/subsystem/LDEventSender.js.map +0 -1
- package/dist/api/subsystem/LDStreamProcessor.js +0 -3
- package/dist/api/subsystem/LDStreamProcessor.js.map +0 -1
- package/dist/api/subsystem/index.js +0 -7
- package/dist/api/subsystem/index.js.map +0 -1
- package/dist/errors.js +0 -78
- package/dist/errors.js.map +0 -1
- package/dist/index.js +0 -31
- package/dist/index.js.map +0 -1
- package/dist/internal/context/index.js +0 -38
- package/dist/internal/context/index.js.map +0 -1
- package/dist/internal/diagnostics/DiagnosticsManager.js +0 -70
- package/dist/internal/diagnostics/DiagnosticsManager.js.map +0 -1
- package/dist/internal/diagnostics/index.js +0 -6
- package/dist/internal/diagnostics/index.js.map +0 -1
- package/dist/internal/diagnostics/types.js +0 -3
- package/dist/internal/diagnostics/types.js.map +0 -1
- package/dist/internal/evaluation/ErrorKinds.js +0 -15
- package/dist/internal/evaluation/ErrorKinds.js.map +0 -1
- package/dist/internal/evaluation/EventFactoryBase.js +0 -38
- package/dist/internal/evaluation/EventFactoryBase.js.map +0 -1
- package/dist/internal/evaluation/index.js +0 -8
- package/dist/internal/evaluation/index.js.map +0 -1
- package/dist/internal/events/ClientMessages.js +0 -14
- package/dist/internal/events/ClientMessages.js.map +0 -1
- package/dist/internal/events/EventProcessor.js +0 -263
- package/dist/internal/events/EventProcessor.js.map +0 -1
- package/dist/internal/events/EventSender.js +0 -77
- package/dist/internal/events/EventSender.js.map +0 -1
- package/dist/internal/events/EventSummarizer.js +0 -84
- package/dist/internal/events/EventSummarizer.js.map +0 -1
- package/dist/internal/events/InputClickEvent.js +0 -3
- package/dist/internal/events/InputClickEvent.js.map +0 -1
- package/dist/internal/events/InputCustomEvent.js +0 -22
- package/dist/internal/events/InputCustomEvent.js.map +0 -1
- package/dist/internal/events/InputEvalEvent.js +0 -38
- package/dist/internal/events/InputEvalEvent.js.map +0 -1
- package/dist/internal/events/InputEvent.js +0 -3
- package/dist/internal/events/InputEvent.js.map +0 -1
- package/dist/internal/events/InputEventBase.js +0 -11
- package/dist/internal/events/InputEventBase.js.map +0 -1
- package/dist/internal/events/InputIdentifyEvent.js +0 -12
- package/dist/internal/events/InputIdentifyEvent.js.map +0 -1
- package/dist/internal/events/InputMigrationEvent.js +0 -7
- package/dist/internal/events/InputMigrationEvent.js.map +0 -1
- package/dist/internal/events/InputPageViewEvent.js +0 -3
- package/dist/internal/events/InputPageViewEvent.js.map +0 -1
- package/dist/internal/events/LDInternalOptions.js +0 -3
- package/dist/internal/events/LDInternalOptions.js.map +0 -1
- package/dist/internal/events/LDInvalidSDKKeyError.js +0 -10
- package/dist/internal/events/LDInvalidSDKKeyError.js.map +0 -1
- package/dist/internal/events/NullEventProcessor.js +0 -11
- package/dist/internal/events/NullEventProcessor.js.map +0 -1
- package/dist/internal/events/SummaryCounter.js +0 -20
- package/dist/internal/events/SummaryCounter.js.map +0 -1
- package/dist/internal/events/guards.js +0 -20
- package/dist/internal/events/guards.js.map +0 -1
- package/dist/internal/events/index.js +0 -18
- package/dist/internal/events/index.js.map +0 -1
- package/dist/internal/events/sampling.js +0 -23
- package/dist/internal/events/sampling.js.map +0 -1
- package/dist/internal/index.js +0 -22
- package/dist/internal/index.js.map +0 -1
- package/dist/internal/stream/StreamingProcessor.js +0 -113
- package/dist/internal/stream/StreamingProcessor.js.map +0 -1
- package/dist/internal/stream/index.js +0 -6
- package/dist/internal/stream/index.js.map +0 -1
- package/dist/internal/stream/types.js +0 -3
- package/dist/internal/stream/types.js.map +0 -1
- package/dist/logging/BasicLogger.js +0 -97
- package/dist/logging/BasicLogger.js.map +0 -1
- package/dist/logging/SafeLogger.js +0 -63
- package/dist/logging/SafeLogger.js.map +0 -1
- package/dist/logging/createSafeLogger.js +0 -16
- package/dist/logging/createSafeLogger.js.map +0 -1
- package/dist/logging/format.js +0 -156
- package/dist/logging/format.js.map +0 -1
- package/dist/logging/index.js +0 -10
- package/dist/logging/index.js.map +0 -1
- package/dist/options/ApplicationTags.js +0 -55
- package/dist/options/ApplicationTags.js.map +0 -1
- package/dist/options/ClientContext.js +0 -20
- package/dist/options/ClientContext.js.map +0 -1
- package/dist/options/OptionMessages.js +0 -33
- package/dist/options/OptionMessages.js.map +0 -1
- package/dist/options/ServiceEndpoints.js +0 -77
- package/dist/options/ServiceEndpoints.js.map +0 -1
- package/dist/options/index.js +0 -15
- package/dist/options/index.js.map +0 -1
- package/dist/utils/VoidFunction.js +0 -3
- package/dist/utils/VoidFunction.js.map +0 -1
- package/dist/utils/cancelableTimedPromise.js +0 -30
- package/dist/utils/cancelableTimedPromise.js.map +0 -1
- package/dist/utils/clone.js +0 -10
- package/dist/utils/clone.js.map +0 -1
- package/dist/utils/date.js +0 -9
- package/dist/utils/date.js.map +0 -1
- package/dist/utils/debounce.js +0 -33
- package/dist/utils/debounce.js.map +0 -1
- package/dist/utils/deepCompact.js +0 -24
- package/dist/utils/deepCompact.js.map +0 -1
- package/dist/utils/fast-deep-equal/index.js +0 -90
- package/dist/utils/fast-deep-equal/index.js.map +0 -1
- package/dist/utils/http.js +0 -53
- package/dist/utils/http.js.map +0 -1
- package/dist/utils/index.js +0 -27
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/isEmptyObject.js +0 -5
- package/dist/utils/isEmptyObject.js.map +0 -1
- package/dist/utils/noop.js +0 -4
- package/dist/utils/noop.js.map +0 -1
- package/dist/utils/sleep.js +0 -7
- package/dist/utils/sleep.js.map +0 -1
- package/dist/utils/timedPromise.js +0 -17
- package/dist/utils/timedPromise.js.map +0 -1
- package/dist/validators.js +0 -175
- package/dist/validators.js.map +0 -1
package/dist/utils/http.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.base64UrlEncode = exports.shouldRetry = exports.httpErrorMessage = exports.defaultHeaders = void 0;
|
|
4
|
-
const errors_1 = require("../errors");
|
|
5
|
-
function defaultHeaders(sdkKey, info, tags, includeAuthorizationHeader = true, userAgentHeaderName = 'user-agent') {
|
|
6
|
-
const { userAgentBase, version, wrapperName, wrapperVersion } = info.sdkData();
|
|
7
|
-
const headers = {
|
|
8
|
-
[userAgentHeaderName]: `${userAgentBase !== null && userAgentBase !== void 0 ? userAgentBase : 'NodeJSClient'}/${version}`,
|
|
9
|
-
};
|
|
10
|
-
// edge sdks sets this to false because they use the clientSideID
|
|
11
|
-
// and they don't need the authorization header
|
|
12
|
-
if (includeAuthorizationHeader) {
|
|
13
|
-
headers.authorization = sdkKey;
|
|
14
|
-
}
|
|
15
|
-
if (wrapperName) {
|
|
16
|
-
headers['x-launchdarkly-wrapper'] = wrapperVersion
|
|
17
|
-
? `${wrapperName}/${wrapperVersion}`
|
|
18
|
-
: wrapperName;
|
|
19
|
-
}
|
|
20
|
-
if (tags === null || tags === void 0 ? void 0 : tags.value) {
|
|
21
|
-
headers['x-launchdarkly-tags'] = tags.value;
|
|
22
|
-
}
|
|
23
|
-
return headers;
|
|
24
|
-
}
|
|
25
|
-
exports.defaultHeaders = defaultHeaders;
|
|
26
|
-
function httpErrorMessage(err, context, retryMessage) {
|
|
27
|
-
let desc;
|
|
28
|
-
if (err.status) {
|
|
29
|
-
desc = `error ${err.status}${err.status === 401 ? ' (invalid SDK key)' : ''}`;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
desc = `I/O error (${err.message || 'unknown error'})`;
|
|
33
|
-
}
|
|
34
|
-
const action = retryMessage !== null && retryMessage !== void 0 ? retryMessage : 'giving up permanently';
|
|
35
|
-
return `Received ${desc} for ${context} - ${action}`;
|
|
36
|
-
}
|
|
37
|
-
exports.httpErrorMessage = httpErrorMessage;
|
|
38
|
-
function shouldRetry({ status }) {
|
|
39
|
-
return status ? (0, errors_1.isHttpRecoverable)(status) : true;
|
|
40
|
-
}
|
|
41
|
-
exports.shouldRetry = shouldRetry;
|
|
42
|
-
/**
|
|
43
|
-
* In react-native use base64-js to polyfill btoa. This is safe
|
|
44
|
-
* because the react-native repo uses it too. Set the global.btoa to the encode
|
|
45
|
-
* function of base64-js.
|
|
46
|
-
* https://github.com/beatgammit/base64-js
|
|
47
|
-
* https://github.com/axios/axios/issues/2235#issuecomment-512204616
|
|
48
|
-
*
|
|
49
|
-
* Ripped from https://thewoods.blog/base64url/
|
|
50
|
-
*/
|
|
51
|
-
const base64UrlEncode = (s, encoding) => encoding.btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
52
|
-
exports.base64UrlEncode = base64UrlEncode;
|
|
53
|
-
//# sourceMappingURL=http.js.map
|
package/dist/utils/http.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;AACA,sCAA8C;AAW9C,SAAgB,cAAc,CAC5B,MAAc,EACd,IAAU,EACV,IAAsB,EACtB,6BAAsC,IAAI,EAC1C,sBAAkE,YAAY;IAE9E,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAE/E,MAAM,OAAO,GAAc;QACzB,CAAC,mBAAmB,CAAC,EAAE,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,cAAc,IAAI,OAAO,EAAE;KACvE,CAAC;IAEF,iEAAiE;IACjE,+CAA+C;IAC/C,IAAI,0BAA0B,EAAE;QAC9B,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC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AC,KAAK,EAAE,EAAE,CAAC,CAAC;AADjE,QAAA,eAAe,mBACkD"}
|
package/dist/utils/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cancelableTimedPromise = exports.timedPromise = exports.sleep = exports.secondsToMillis = exports.shouldRetry = exports.noop = exports.httpErrorMessage = exports.fastDeepEqual = exports.defaultHeaders = exports.deepCompact = exports.debounce = exports.clone = exports.base64UrlEncode = void 0;
|
|
4
|
-
const cancelableTimedPromise_1 = require("./cancelableTimedPromise");
|
|
5
|
-
Object.defineProperty(exports, "cancelableTimedPromise", { enumerable: true, get: function () { return cancelableTimedPromise_1.cancelableTimedPromise; } });
|
|
6
|
-
const clone_1 = require("./clone");
|
|
7
|
-
exports.clone = clone_1.default;
|
|
8
|
-
const date_1 = require("./date");
|
|
9
|
-
Object.defineProperty(exports, "secondsToMillis", { enumerable: true, get: function () { return date_1.secondsToMillis; } });
|
|
10
|
-
const debounce_1 = require("./debounce");
|
|
11
|
-
exports.debounce = debounce_1.default;
|
|
12
|
-
const deepCompact_1 = require("./deepCompact");
|
|
13
|
-
exports.deepCompact = deepCompact_1.default;
|
|
14
|
-
const fast_deep_equal_1 = require("./fast-deep-equal");
|
|
15
|
-
exports.fastDeepEqual = fast_deep_equal_1.default;
|
|
16
|
-
const http_1 = require("./http");
|
|
17
|
-
Object.defineProperty(exports, "base64UrlEncode", { enumerable: true, get: function () { return http_1.base64UrlEncode; } });
|
|
18
|
-
Object.defineProperty(exports, "defaultHeaders", { enumerable: true, get: function () { return http_1.defaultHeaders; } });
|
|
19
|
-
Object.defineProperty(exports, "httpErrorMessage", { enumerable: true, get: function () { return http_1.httpErrorMessage; } });
|
|
20
|
-
Object.defineProperty(exports, "shouldRetry", { enumerable: true, get: function () { return http_1.shouldRetry; } });
|
|
21
|
-
const noop_1 = require("./noop");
|
|
22
|
-
exports.noop = noop_1.default;
|
|
23
|
-
const sleep_1 = require("./sleep");
|
|
24
|
-
exports.sleep = sleep_1.default;
|
|
25
|
-
const timedPromise_1 = require("./timedPromise");
|
|
26
|
-
exports.timedPromise = timedPromise_1.default;
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,qEAA0F;AA4BxF,uGA5BO,+CAAsB,OA4BP;AA3BxB,mCAA4B;AAa1B,gBAbK,eAAK,CAaL;AAZP,iCAAyC;AAqBvC,gGArBO,sBAAe,OAqBP;AApBjB,yCAAkC;AAYhC,mBAZK,kBAAQ,CAYL;AAXV,+CAAwC;AAYtC,sBAZK,qBAAW,CAYL;AAXb,uDAA8C;AAa5C,wBAbK,yBAAa,CAaL;AAZf,iCAAmG;AAOjG,gGAPO,sBAAe,OAOP;AAIf,+FAXwB,qBAAc,OAWxB;AAEd,iGAbwC,uBAAgB,OAaxC;AAGhB,4FAhBqE,kBAAW,OAgBrE;AAfb,iCAA0B;AAaxB,eAbK,cAAI,CAaL;AAZN,mCAA4B;AAgB1B,gBAhBK,eAAK,CAgBL;AAfP,iDAA0C;AAgBxC,uBAhBK,sBAAY,CAgBL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyObject.js","sourceRoot":"","sources":["../../src/utils/isEmptyObject.ts"],"names":[],"mappings":";;AAAA,MAAM,aAAa,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAEjE,kBAAe,aAAa,CAAC"}
|
package/dist/utils/noop.js
DELETED
package/dist/utils/noop.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/utils/noop.ts"],"names":[],"mappings":";;AAAA,kBAAe,GAAG,EAAE,GAAE,CAAC,CAAC"}
|
package/dist/utils/sleep.js
DELETED
package/dist/utils/sleep.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG,KAAK,EAAE,cAAsB,IAAI,EAAE,EAAE,CACjD,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,kBAAe,KAAK,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const errors_1 = require("../errors");
|
|
4
|
-
/**
|
|
5
|
-
* Returns a promise which errors after t seconds.
|
|
6
|
-
*
|
|
7
|
-
* @param t Timeout in seconds.
|
|
8
|
-
* @param taskName Name of task being timed for logging and error reporting.
|
|
9
|
-
*/
|
|
10
|
-
const timedPromise = (t, taskName) => new Promise((_res, reject) => {
|
|
11
|
-
setTimeout(() => {
|
|
12
|
-
const e = `${taskName} timed out after ${t} seconds.`;
|
|
13
|
-
reject(new errors_1.LDTimeoutError(e));
|
|
14
|
-
}, t * 1000);
|
|
15
|
-
});
|
|
16
|
-
exports.default = timedPromise;
|
|
17
|
-
//# sourceMappingURL=timedPromise.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timedPromise.js","sourceRoot":"","sources":["../../src/utils/timedPromise.ts"],"names":[],"mappings":";;AAAA,sCAA2C;AAE3C;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,QAAgB,EAAE,EAAE,CACnD,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;IACjC,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,GAAG,GAAG,QAAQ,oBAAoB,CAAC,WAAW,CAAC;QACtD,MAAM,CAAC,IAAI,uBAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACf,CAAC,CAAC,CAAC;AAEL,kBAAe,YAAY,CAAC"}
|
package/dist/validators.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable class-methods-use-this */
|
|
3
|
-
/* eslint-disable max-classes-per-file */
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.TypeValidators = exports.KindValidator = exports.DateValidator = exports.NullableBoolean = exports.Function = exports.StringMatchingRegex = exports.NumberWithMinimum = exports.TypeArray = exports.Type = exports.FactoryOrInstance = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* Validate a factory or instance.
|
|
8
|
-
*/
|
|
9
|
-
class FactoryOrInstance {
|
|
10
|
-
is(factoryOrInstance) {
|
|
11
|
-
if (Array.isArray(factoryOrInstance)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
const anyFactory = factoryOrInstance;
|
|
15
|
-
const typeOfFactory = typeof anyFactory;
|
|
16
|
-
return typeOfFactory === 'function' || typeOfFactory === 'object';
|
|
17
|
-
}
|
|
18
|
-
getType() {
|
|
19
|
-
return 'factory method or object';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.FactoryOrInstance = FactoryOrInstance;
|
|
23
|
-
/**
|
|
24
|
-
* Validate a basic type.
|
|
25
|
-
*/
|
|
26
|
-
class Type {
|
|
27
|
-
constructor(typeName, example) {
|
|
28
|
-
this.typeName = typeName;
|
|
29
|
-
this.typeOf = typeof example;
|
|
30
|
-
}
|
|
31
|
-
is(u) {
|
|
32
|
-
if (Array.isArray(u)) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
return typeof u === this.typeOf;
|
|
36
|
-
}
|
|
37
|
-
getType() {
|
|
38
|
-
return this.typeName;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.Type = Type;
|
|
42
|
-
/**
|
|
43
|
-
* Validate an array of the specified type.
|
|
44
|
-
*
|
|
45
|
-
* This does not validate instances of types. All class instances
|
|
46
|
-
* of classes will simply objects.
|
|
47
|
-
*/
|
|
48
|
-
class TypeArray {
|
|
49
|
-
constructor(typeName, example) {
|
|
50
|
-
this.typeName = typeName;
|
|
51
|
-
this.typeOf = typeof example;
|
|
52
|
-
}
|
|
53
|
-
is(u) {
|
|
54
|
-
if (Array.isArray(u)) {
|
|
55
|
-
if (u.length > 0) {
|
|
56
|
-
return u.every((val) => typeof val === this.typeOf);
|
|
57
|
-
}
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
getType() {
|
|
63
|
-
return this.typeName;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.TypeArray = TypeArray;
|
|
67
|
-
/**
|
|
68
|
-
* Validate a value is a number and is greater or eval than a minimum.
|
|
69
|
-
*/
|
|
70
|
-
class NumberWithMinimum extends Type {
|
|
71
|
-
constructor(min) {
|
|
72
|
-
super(`number with minimum value of ${min}`, 0);
|
|
73
|
-
this.min = min;
|
|
74
|
-
}
|
|
75
|
-
is(u) {
|
|
76
|
-
return typeof u === this.typeOf && u >= this.min;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.NumberWithMinimum = NumberWithMinimum;
|
|
80
|
-
/**
|
|
81
|
-
* Validate a value is a string and it matches the given expression.
|
|
82
|
-
*/
|
|
83
|
-
class StringMatchingRegex extends Type {
|
|
84
|
-
constructor(expression) {
|
|
85
|
-
super(`string matching ${expression}`, '');
|
|
86
|
-
this.expression = expression;
|
|
87
|
-
}
|
|
88
|
-
is(u) {
|
|
89
|
-
return typeof u === 'string' && !!u.match(this.expression);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.StringMatchingRegex = StringMatchingRegex;
|
|
93
|
-
/**
|
|
94
|
-
* Validate a value is a function.
|
|
95
|
-
*/
|
|
96
|
-
class Function {
|
|
97
|
-
is(u) {
|
|
98
|
-
// We cannot inspect the parameters and there isn't really
|
|
99
|
-
// a generic function type we can instantiate.
|
|
100
|
-
// So the type guard is here just to make TS comfortable
|
|
101
|
-
// calling something after using this guard.
|
|
102
|
-
return typeof u === 'function';
|
|
103
|
-
}
|
|
104
|
-
getType() {
|
|
105
|
-
return 'function';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.Function = Function;
|
|
109
|
-
class NullableBoolean {
|
|
110
|
-
is(u) {
|
|
111
|
-
return typeof u === 'boolean' || typeof u === 'undefined' || u === null;
|
|
112
|
-
}
|
|
113
|
-
getType() {
|
|
114
|
-
return 'boolean | undefined | null';
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.NullableBoolean = NullableBoolean;
|
|
118
|
-
// Our reference SDK, Go, parses date/time strings with the time.RFC3339Nano format.
|
|
119
|
-
// This regex should match strings that are valid in that format, and no others.
|
|
120
|
-
// Acceptable:
|
|
121
|
-
// 2019-10-31T23:59:59Z, 2019-10-31T23:59:59.100Z,
|
|
122
|
-
// 2019-10-31T23:59:59-07, 2019-10-31T23:59:59-07:00, etc.
|
|
123
|
-
// Unacceptable: no "T", no time zone designation
|
|
124
|
-
const DATE_REGEX = /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/;
|
|
125
|
-
/**
|
|
126
|
-
* Validate a value is a date. Values which are numbers are treated as dates and any string
|
|
127
|
-
* which if compliant with `time.RFC3339Nano` is a date.
|
|
128
|
-
*/
|
|
129
|
-
class DateValidator {
|
|
130
|
-
is(u) {
|
|
131
|
-
return typeof u === 'number' || (typeof u === 'string' && DATE_REGEX.test(u));
|
|
132
|
-
}
|
|
133
|
-
getType() {
|
|
134
|
-
return 'date';
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.DateValidator = DateValidator;
|
|
138
|
-
/**
|
|
139
|
-
* Validates that a string is a valid kind.
|
|
140
|
-
*/
|
|
141
|
-
class KindValidator extends StringMatchingRegex {
|
|
142
|
-
constructor() {
|
|
143
|
-
super(/^(\w|\.|-)+$/);
|
|
144
|
-
}
|
|
145
|
-
is(u) {
|
|
146
|
-
return super.is(u) && u !== 'kind';
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.KindValidator = KindValidator;
|
|
150
|
-
/**
|
|
151
|
-
* A set of standard type validators.
|
|
152
|
-
*/
|
|
153
|
-
class TypeValidators {
|
|
154
|
-
static createTypeArray(typeName, example) {
|
|
155
|
-
return new TypeArray(typeName, example);
|
|
156
|
-
}
|
|
157
|
-
static numberWithMin(min) {
|
|
158
|
-
return new NumberWithMinimum(min);
|
|
159
|
-
}
|
|
160
|
-
static stringMatchingRegex(expression) {
|
|
161
|
-
return new StringMatchingRegex(expression);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exports.TypeValidators = TypeValidators;
|
|
165
|
-
TypeValidators.String = new Type('string', '');
|
|
166
|
-
TypeValidators.Number = new Type('number', 0);
|
|
167
|
-
TypeValidators.ObjectOrFactory = new FactoryOrInstance();
|
|
168
|
-
TypeValidators.Object = new Type('object', {});
|
|
169
|
-
TypeValidators.StringArray = new TypeArray('string[]', '');
|
|
170
|
-
TypeValidators.Boolean = new Type('boolean', true);
|
|
171
|
-
TypeValidators.Function = new Function();
|
|
172
|
-
TypeValidators.Date = new DateValidator();
|
|
173
|
-
TypeValidators.Kind = new KindValidator();
|
|
174
|
-
TypeValidators.NullableBoolean = new NullableBoolean();
|
|
175
|
-
//# sourceMappingURL=validators.js.map
|
package/dist/validators.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,yCAAyC;;;AAiBzC;;GAEG;AACH,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