@api-client/core 0.6.30 → 0.7.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/build/browser.d.ts +6 -14
- package/build/browser.js +11 -16
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +8 -20
- package/build/index.js +13 -25
- package/build/index.js.map +1 -1
- package/build/src/amf/ApiSchemaValues.d.ts +2 -0
- package/build/src/amf/ApiSchemaValues.js +29 -23
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/authorization/lib/Utils.d.ts +1 -1
- package/build/src/cookies/CookieJar.d.ts +23 -0
- package/build/src/cookies/CookieJar.js +3 -0
- package/build/src/cookies/CookieJar.js.map +1 -0
- package/build/src/cookies/CookieParser.d.ts +67 -0
- package/build/src/cookies/CookieParser.js +316 -0
- package/build/src/cookies/CookieParser.js.map +1 -0
- package/build/src/cookies/InMemoryCookieJar.d.ts +12 -0
- package/build/src/cookies/InMemoryCookieJar.js +68 -0
- package/build/src/cookies/InMemoryCookieJar.js.map +1 -0
- package/build/src/cookies/Punycode.d.ts +12 -0
- package/build/src/cookies/Punycode.js +124 -0
- package/build/src/cookies/Punycode.js.map +1 -0
- package/build/src/data/RequestDataExtractor.d.ts +8 -7
- package/build/src/data/RequestDataExtractor.js +8 -10
- package/build/src/data/RequestDataExtractor.js.map +1 -1
- package/build/src/events/CustomEvent.js +5 -0
- package/build/src/events/CustomEvent.js.map +1 -1
- package/build/src/events/EventTypes.d.ts +43 -43
- package/build/src/events/amf/AmfEventTypes.d.ts +4 -4
- package/build/src/events/authorization/AuthorizationEventTypes.d.ts +4 -4
- package/build/src/events/cookies/CookieEventTypes.d.ts +9 -9
- package/build/src/events/encryption/EncryptionEventTypes.d.ts +2 -2
- package/build/src/events/environment/EnvironmentEventTypes.d.ts +1 -1
- package/build/src/events/models/ModelEventTypes.d.ts +7 -7
- package/build/src/events/process/ProcessEventTypes.d.ts +3 -3
- package/build/src/events/reporting/ReportingEventTypes.d.ts +1 -1
- package/build/src/events/telemetry/TelemetryEventTypes.d.ts +6 -6
- package/build/src/events/transport/TransportEventTypes.d.ts +6 -6
- package/build/src/events/transport/TransportEvents.d.ts +2 -2
- package/build/src/mocking/ProjectMock.d.ts +3 -2
- package/build/src/mocking/ProjectMock.js +3 -3
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/lib/App.d.ts +36 -0
- package/build/src/mocking/lib/App.js +70 -0
- package/build/src/mocking/lib/App.js.map +1 -0
- package/build/src/models/{arc/ArcProject.d.ts → AppProject.d.ts} +296 -134
- package/build/src/models/{arc/ArcProject.js → AppProject.js} +436 -79
- package/build/src/models/AppProject.js.map +1 -0
- package/build/src/models/AppRequest.d.ts +69 -0
- package/build/src/models/{arc/ArcHttpRequest.js → AppRequest.js} +53 -17
- package/build/src/models/AppRequest.js.map +1 -0
- package/build/src/models/ClientCertificate.d.ts +2 -2
- package/build/src/models/Environment.d.ts +8 -1
- package/build/src/models/Environment.js +21 -0
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/HostRule.d.ts +2 -2
- package/build/src/models/HttpCookie.d.ts +63 -12
- package/build/src/models/HttpCookie.js +178 -44
- package/build/src/models/HttpCookie.js.map +1 -1
- package/build/src/models/HttpHistory.d.ts +8 -3
- package/build/src/models/HttpHistory.js +3 -3
- package/build/src/models/HttpHistory.js.map +1 -1
- package/build/src/models/HttpProject.d.ts +34 -1
- package/build/src/models/HttpProject.js +104 -8
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts +2 -0
- package/build/src/models/ProjectFolder.js +14 -0
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/ProjectItem.d.ts +2 -0
- package/build/src/models/ProjectItem.js +20 -0
- package/build/src/models/ProjectItem.js.map +1 -1
- package/build/src/models/ProjectParent.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts +3 -2
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/Property.d.ts +2 -2
- package/build/src/models/Property.js +2 -2
- package/build/src/models/Property.js.map +1 -1
- package/build/src/models/Request.d.ts +16 -8
- package/build/src/models/Request.js +20 -15
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/RequestAuthorization.js.map +1 -1
- package/build/src/models/RequestUiMeta.d.ts +0 -14
- package/build/src/models/RequestUiMeta.js +1 -10
- package/build/src/models/RequestUiMeta.js.map +1 -1
- package/build/src/models/Server.d.ts +1 -2
- package/build/src/models/Server.js.map +1 -1
- package/build/src/models/http-actions/HttpActions.d.ts +256 -0
- package/build/src/models/http-actions/HttpActions.js +46 -0
- package/build/src/models/http-actions/HttpActions.js.map +1 -0
- package/build/src/models/http-actions/LegacyTranslator.d.ts +17 -0
- package/build/src/models/http-actions/LegacyTranslator.js +222 -0
- package/build/src/models/http-actions/LegacyTranslator.js.map +1 -0
- package/build/src/models/store/Backend.d.ts +136 -1
- package/build/src/models/store/File.d.ts +1 -1
- package/build/src/models/store/File.js +2 -0
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/User.d.ts +3 -3
- package/build/src/runtime/http-engine/CoreEngine.d.ts +2 -0
- package/build/src/runtime/http-engine/CoreEngine.js +1 -0
- package/build/src/runtime/http-engine/CoreEngine.js.map +1 -1
- package/build/src/runtime/http-engine/HttpEngine.d.ts +13 -0
- package/build/src/runtime/http-engine/HttpEngine.js +39 -31
- package/build/src/runtime/http-engine/HttpEngine.js.map +1 -1
- package/build/src/runtime/{actions/ConditionRunner.d.ts → http-runner/ConditionCheck.d.ts} +2 -2
- package/build/src/runtime/{actions/ConditionRunner.js → http-runner/ConditionCheck.js} +2 -2
- package/build/src/runtime/http-runner/ConditionCheck.js.map +1 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.d.ts +62 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.js +217 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.js.map +1 -0
- package/build/src/runtime/{node/RequestFactory.d.ts → http-runner/HttpRequestRunner.d.ts} +40 -54
- package/build/src/runtime/http-runner/HttpRequestRunner.js +316 -0
- package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -0
- package/build/src/runtime/http-runner/HttpRuntimeEnvironment.d.ts +25 -0
- package/build/src/runtime/http-runner/HttpRuntimeEnvironment.js +2 -0
- package/build/src/runtime/http-runner/HttpRuntimeEnvironment.js.map +1 -0
- package/build/src/runtime/http-runner/RequestAuthorizationProcessor.d.ts +56 -0
- package/build/src/runtime/http-runner/RequestAuthorizationProcessor.js +143 -0
- package/build/src/runtime/http-runner/RequestAuthorizationProcessor.js.map +1 -0
- package/build/src/runtime/http-runner/RequestCookiesProcessor.d.ts +24 -0
- package/build/src/runtime/http-runner/RequestCookiesProcessor.js +65 -0
- package/build/src/runtime/http-runner/RequestCookiesProcessor.js.map +1 -0
- package/build/src/runtime/node/InteropInterfaces.d.ts +21 -6
- package/build/src/runtime/node/ProjectParallelRunner.js +3 -1
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.d.ts +24 -10
- package/build/src/runtime/node/ProjectRequestRunner.js +116 -45
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +5 -7
- package/build/src/runtime/node/ProjectRunner.js +30 -14
- package/build/src/runtime/node/ProjectRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunnerWorker.js +3 -0
- package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
- package/build/src/runtime/reporters/Reporter.d.ts +5 -0
- package/build/src/runtime/reporters/Reporter.js.map +1 -1
- package/build/src/runtime/store/AppSdk.d.ts +185 -0
- package/build/src/runtime/store/AppSdk.js +704 -0
- package/build/src/runtime/store/AppSdk.js.map +1 -0
- package/build/src/runtime/store/FilesSdk.js +4 -4
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/src/runtime/store/HistorySdk.js +2 -2
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/RouteBuilder.d.ts +17 -2
- package/build/src/runtime/store/RouteBuilder.js +60 -3
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +5 -0
- package/build/src/runtime/store/Sdk.js +5 -0
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.js +1 -1
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/UsersSdk.js +1 -1
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/package.json +2 -2
- package/src/amf/ApiSchemaValues.ts +41 -33
- package/src/cookies/CookieJar.ts +26 -0
- package/src/cookies/CookieParser.ts +327 -0
- package/src/cookies/InMemoryCookieJar.ts +70 -0
- package/src/cookies/Punycode.ts +133 -0
- package/src/data/RequestDataExtractor.ts +14 -15
- package/src/events/CustomEvent.ts +4 -0
- package/src/mocking/ProjectMock.ts +4 -3
- package/src/mocking/lib/App.ts +101 -0
- package/src/models/{arc/ArcProject.ts → AppProject.ts} +671 -225
- package/src/models/AppRequest.ts +176 -0
- package/src/models/ClientCertificate.ts +2 -2
- package/src/models/Environment.ts +24 -2
- package/src/models/HostRule.ts +2 -2
- package/src/models/HttpCookie.ts +210 -48
- package/src/models/HttpHistory.ts +12 -5
- package/src/models/HttpProject.ts +113 -10
- package/src/models/ProjectFolder.ts +16 -0
- package/src/models/ProjectItem.ts +18 -0
- package/src/models/ProjectParent.ts +4 -1
- package/src/models/ProjectRequest.ts +4 -3
- package/src/models/Property.ts +4 -4
- package/src/models/Request.ts +29 -19
- package/src/models/RequestAuthorization.ts +4 -4
- package/src/models/RequestUiMeta.ts +1 -21
- package/src/models/Server.ts +1 -2
- package/src/models/http-actions/HttpActions.ts +270 -0
- package/src/models/http-actions/LegacyTranslator.ts +223 -0
- package/src/models/store/Backend.ts +148 -2
- package/src/models/store/File.ts +3 -1
- package/src/models/store/User.ts +3 -3
- package/src/runtime/http-engine/CoreEngine.ts +3 -2
- package/src/runtime/http-engine/HttpEngine.ts +48 -30
- package/src/runtime/{actions/ConditionRunner.ts → http-runner/ConditionCheck.ts} +3 -3
- package/src/runtime/http-runner/HttpFlowRunner.ts +232 -0
- package/src/runtime/http-runner/HttpRequestRunner.ts +353 -0
- package/src/runtime/http-runner/HttpRuntimeEnvironment.ts +27 -0
- package/src/runtime/http-runner/RequestAuthorizationProcessor.ts +144 -0
- package/src/runtime/http-runner/RequestCookiesProcessor.ts +74 -0
- package/src/runtime/node/InteropInterfaces.ts +24 -6
- package/src/runtime/node/ProjectParallelRunner.ts +4 -2
- package/src/runtime/node/ProjectRequestRunner.ts +130 -60
- package/src/runtime/node/ProjectRunner.ts +37 -22
- package/src/runtime/node/ProjectRunnerWorker.ts +3 -0
- package/src/runtime/reporters/Reporter.ts +5 -0
- package/src/runtime/store/AppSdk.ts +709 -0
- package/src/runtime/store/FilesSdk.ts +4 -4
- package/src/runtime/store/HistorySdk.ts +2 -2
- package/src/runtime/store/RouteBuilder.ts +75 -3
- package/src/runtime/store/Sdk.ts +6 -0
- package/src/runtime/store/SharedSdk.ts +1 -1
- package/src/runtime/store/UsersSdk.ts +1 -1
- package/build/src/lib/cookies/Cookie.d.ts +0 -123
- package/build/src/lib/cookies/Cookie.js +0 -257
- package/build/src/lib/cookies/Cookie.js.map +0 -1
- package/build/src/lib/cookies/Cookies.d.ts +0 -90
- package/build/src/lib/cookies/Cookies.js +0 -310
- package/build/src/lib/cookies/Cookies.js.map +0 -1
- package/build/src/lib/cookies/Utils.d.ts +0 -47
- package/build/src/lib/cookies/Utils.js +0 -163
- package/build/src/lib/cookies/Utils.js.map +0 -1
- package/build/src/mocking/lib/Arc.d.ts +0 -10
- package/build/src/mocking/lib/Arc.js +0 -31
- package/build/src/mocking/lib/Arc.js.map +0 -1
- package/build/src/models/RequestActions.d.ts +0 -65
- package/build/src/models/RequestActions.js +0 -114
- package/build/src/models/RequestActions.js.map +0 -1
- package/build/src/models/actions/Action.d.ts +0 -75
- package/build/src/models/actions/Action.js +0 -188
- package/build/src/models/actions/Action.js.map +0 -1
- package/build/src/models/actions/ActionView.d.ts +0 -15
- package/build/src/models/actions/ActionView.js +0 -33
- package/build/src/models/actions/ActionView.js.map +0 -1
- package/build/src/models/actions/Condition.d.ts +0 -81
- package/build/src/models/actions/Condition.js +0 -185
- package/build/src/models/actions/Condition.js.map +0 -1
- package/build/src/models/actions/ConditionView.d.ts +0 -17
- package/build/src/models/actions/ConditionView.js +0 -34
- package/build/src/models/actions/ConditionView.js.map +0 -1
- package/build/src/models/actions/Enums.d.ts +0 -26
- package/build/src/models/actions/Enums.js +0 -31
- package/build/src/models/actions/Enums.js.map +0 -1
- package/build/src/models/actions/RunnableAction.d.ts +0 -59
- package/build/src/models/actions/RunnableAction.js +0 -106
- package/build/src/models/actions/RunnableAction.js.map +0 -1
- package/build/src/models/actions/runnable/DeleteCookieAction.d.ts +0 -44
- package/build/src/models/actions/runnable/DeleteCookieAction.js +0 -92
- package/build/src/models/actions/runnable/DeleteCookieAction.js.map +0 -1
- package/build/src/models/actions/runnable/Runnable.d.ts +0 -8
- package/build/src/models/actions/runnable/Runnable.js +0 -4
- package/build/src/models/actions/runnable/Runnable.js.map +0 -1
- package/build/src/models/actions/runnable/SetCookieAction.d.ts +0 -87
- package/build/src/models/actions/runnable/SetCookieAction.js +0 -176
- package/build/src/models/actions/runnable/SetCookieAction.js.map +0 -1
- package/build/src/models/actions/runnable/SetVariableAction.d.ts +0 -31
- package/build/src/models/actions/runnable/SetVariableAction.js +0 -63
- package/build/src/models/actions/runnable/SetVariableAction.js.map +0 -1
- package/build/src/models/actions/runnable/index.d.ts +0 -7
- package/build/src/models/actions/runnable/index.js +0 -2
- package/build/src/models/actions/runnable/index.js.map +0 -1
- package/build/src/models/arc/ArcHttpRequest.d.ts +0 -40
- package/build/src/models/arc/ArcHttpRequest.js.map +0 -1
- package/build/src/models/arc/ArcProject.js.map +0 -1
- package/build/src/runtime/actions/ActionRunner.d.ts +0 -17
- package/build/src/runtime/actions/ActionRunner.js +0 -74
- package/build/src/runtime/actions/ActionRunner.js.map +0 -1
- package/build/src/runtime/actions/ConditionRunner.js.map +0 -1
- package/build/src/runtime/actions/RunnableCondition.d.ts +0 -27
- package/build/src/runtime/actions/RunnableCondition.js +0 -50
- package/build/src/runtime/actions/RunnableCondition.js.map +0 -1
- package/build/src/runtime/actions/runnable/ActionRunnable.d.ts +0 -13
- package/build/src/runtime/actions/runnable/ActionRunnable.js +0 -13
- package/build/src/runtime/actions/runnable/ActionRunnable.js.map +0 -1
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.d.ts +0 -7
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js +0 -36
- package/build/src/runtime/actions/runnable/DeleteCookieRunnable.js.map +0 -1
- package/build/src/runtime/actions/runnable/SetCookieRunnable.d.ts +0 -10
- package/build/src/runtime/actions/runnable/SetCookieRunnable.js +0 -89
- package/build/src/runtime/actions/runnable/SetCookieRunnable.js.map +0 -1
- package/build/src/runtime/actions/runnable/SetVariableRunnable.d.ts +0 -10
- package/build/src/runtime/actions/runnable/SetVariableRunnable.js +0 -49
- package/build/src/runtime/actions/runnable/SetVariableRunnable.js.map +0 -1
- package/build/src/runtime/modules/BasicAuthCache.d.ts +0 -39
- package/build/src/runtime/modules/BasicAuthCache.js +0 -122
- package/build/src/runtime/modules/BasicAuthCache.js.map +0 -1
- package/build/src/runtime/modules/ExecutionResponse.d.ts +0 -4
- package/build/src/runtime/modules/ExecutionResponse.js +0 -6
- package/build/src/runtime/modules/ExecutionResponse.js.map +0 -1
- package/build/src/runtime/modules/ModulesRegistry.d.ts +0 -93
- package/build/src/runtime/modules/ModulesRegistry.js +0 -69
- package/build/src/runtime/modules/ModulesRegistry.js.map +0 -1
- package/build/src/runtime/modules/RequestAuthorization.d.ts +0 -6
- package/build/src/runtime/modules/RequestAuthorization.js +0 -110
- package/build/src/runtime/modules/RequestAuthorization.js.map +0 -1
- package/build/src/runtime/modules/RequestCookies.d.ts +0 -17
- package/build/src/runtime/modules/RequestCookies.js +0 -134
- package/build/src/runtime/modules/RequestCookies.js.map +0 -1
- package/build/src/runtime/node/RequestFactory.js +0 -406
- package/build/src/runtime/node/RequestFactory.js.map +0 -1
- package/build/src/runtime/node/VariablesStore.d.ts +0 -9
- package/build/src/runtime/node/VariablesStore.js +0 -19
- package/build/src/runtime/node/VariablesStore.js.map +0 -1
- package/src/lib/cookies/Cookie.ts +0 -312
- package/src/lib/cookies/Cookies.ts +0 -326
- package/src/lib/cookies/Utils.ts +0 -168
- package/src/mocking/lib/Arc.ts +0 -34
- package/src/models/RequestActions.ts +0 -161
- package/src/models/actions/Action.ts +0 -213
- package/src/models/actions/ActionView.ts +0 -40
- package/src/models/actions/Condition.ts +0 -207
- package/src/models/actions/ConditionView.ts +0 -42
- package/src/models/actions/Enums.ts +0 -29
- package/src/models/actions/RunnableAction.ts +0 -144
- package/src/models/actions/runnable/DeleteCookieAction.ts +0 -113
- package/src/models/actions/runnable/Runnable.ts +0 -9
- package/src/models/actions/runnable/SetCookieAction.ts +0 -216
- package/src/models/actions/runnable/SetVariableAction.ts +0 -81
- package/src/models/arc/ArcHttpRequest.ts +0 -129
- package/src/models/arc/readme.md +0 -3
- package/src/runtime/actions/ActionRunner.ts +0 -83
- package/src/runtime/actions/RunnableCondition.ts +0 -56
- package/src/runtime/actions/runnable/ActionRunnable.ts +0 -19
- package/src/runtime/actions/runnable/DeleteCookieRunnable.ts +0 -39
- package/src/runtime/actions/runnable/SetCookieRunnable.ts +0 -92
- package/src/runtime/actions/runnable/SetVariableRunnable.ts +0 -53
- package/src/runtime/modules/BasicAuthCache.ts +0 -129
- package/src/runtime/modules/ExecutionResponse.ts +0 -4
- package/src/runtime/modules/ModulesRegistry.ts +0 -136
- package/src/runtime/modules/RequestAuthorization.ts +0 -106
- package/src/runtime/modules/RequestCookies.ts +0 -146
- package/src/runtime/node/RequestFactory.ts +0 -432
- package/src/runtime/node/VariablesStore.ts +0 -25
|
@@ -73,7 +73,7 @@ export class FilesSdk extends SdkBase {
|
|
|
73
73
|
} catch (e) {
|
|
74
74
|
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
75
75
|
}
|
|
76
|
-
if (!Array.isArray(data.
|
|
76
|
+
if (!Array.isArray(data.items)) {
|
|
77
77
|
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
78
78
|
}
|
|
79
79
|
return data;
|
|
@@ -241,7 +241,7 @@ export class FilesSdk extends SdkBase {
|
|
|
241
241
|
*/
|
|
242
242
|
async readBulk(keys: string[], request: ISdkRequestOptions = {}): Promise<IListResponse<IFile|undefined>> {
|
|
243
243
|
const token = request.token || this.sdk.token;
|
|
244
|
-
const url = this.sdk.getUrl(RouteBuilder.
|
|
244
|
+
const url = this.sdk.getUrl(RouteBuilder.filesBatch());
|
|
245
245
|
const body = JSON.stringify(keys);
|
|
246
246
|
const result = await this.sdk.http.post(url.toString(), { token, body });
|
|
247
247
|
this.inspectCommonStatusCodes(result.status, result.body);
|
|
@@ -264,7 +264,7 @@ export class FilesSdk extends SdkBase {
|
|
|
264
264
|
} catch (e) {
|
|
265
265
|
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
266
266
|
}
|
|
267
|
-
if (!Array.isArray(data.
|
|
267
|
+
if (!Array.isArray(data.items)) {
|
|
268
268
|
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
269
269
|
}
|
|
270
270
|
return data;
|
|
@@ -408,7 +408,7 @@ export class FilesSdk extends SdkBase {
|
|
|
408
408
|
} catch (e) {
|
|
409
409
|
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
410
410
|
}
|
|
411
|
-
if (!Array.isArray(data.
|
|
411
|
+
if (!Array.isArray(data.items)) {
|
|
412
412
|
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
413
413
|
}
|
|
414
414
|
return data;
|
|
@@ -58,7 +58,7 @@ export class HistorySdk extends SdkBase {
|
|
|
58
58
|
}
|
|
59
59
|
let data: string[];
|
|
60
60
|
try {
|
|
61
|
-
data = JSON.parse(result.body).
|
|
61
|
+
data = JSON.parse(result.body).items;
|
|
62
62
|
} catch (e) {
|
|
63
63
|
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
64
64
|
}
|
|
@@ -91,7 +91,7 @@ export class HistorySdk extends SdkBase {
|
|
|
91
91
|
} catch (e) {
|
|
92
92
|
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
93
93
|
}
|
|
94
|
-
if (!Array.isArray(data.
|
|
94
|
+
if (!Array.isArray(data.items)) {
|
|
95
95
|
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
96
96
|
}
|
|
97
97
|
return data;
|
|
@@ -10,10 +10,10 @@ export class RouteBuilder {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @returns The path to the /files/
|
|
13
|
+
* @returns The path to the /files/batch route.
|
|
14
14
|
*/
|
|
15
|
-
static
|
|
16
|
-
return '/files/
|
|
15
|
+
static filesBatch(): string {
|
|
16
|
+
return '/files/batch';
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -83,4 +83,76 @@ export class RouteBuilder {
|
|
|
83
83
|
static shared(): string {
|
|
84
84
|
return '/shared';
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
static app(appId: string): string {
|
|
88
|
+
return `/app/${appId}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// GET, POST
|
|
92
|
+
static appRequests(appId: string): string {
|
|
93
|
+
return `${this.app(appId)}/requests`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// GET, DELETE
|
|
97
|
+
static appRequestItem(appId: string, key: string): string {
|
|
98
|
+
return `${this.appRequests(appId)}${key}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static appRequestsBatch(appId: string): string {
|
|
102
|
+
return `${this.appRequests(appId)}/batch`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// POST
|
|
106
|
+
static appRequestsBatchCreate(appId: string): string {
|
|
107
|
+
return `${this.appRequestsBatch(appId)}/create`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// POST
|
|
111
|
+
static appRequestsBatchRead(appId: string): string {
|
|
112
|
+
return `${this.appRequestsBatch(appId)}/read`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// POST
|
|
116
|
+
static appRequestsBatchDelete(appId: string): string {
|
|
117
|
+
return `${this.appRequestsBatch(appId)}/delete`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// POST
|
|
121
|
+
static appRequestsBatchUndelete(appId: string): string {
|
|
122
|
+
return `${this.appRequestsBatch(appId)}/undelete`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// POST, GET
|
|
126
|
+
static appProjects(appId: string): string {
|
|
127
|
+
return `${this.app(appId)}/projects`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// GET, DELETE
|
|
131
|
+
static appProjectItem(appId: string, key: string): string {
|
|
132
|
+
return `${this.appProjects(appId)}${key}`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static appProjectsBatch(appId: string): string {
|
|
136
|
+
return `${this.appProjects(appId)}/batch`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// POST
|
|
140
|
+
static appProjectsBatchCreate(appId: string): string {
|
|
141
|
+
return `${this.appProjectsBatch(appId)}/create`;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// POST
|
|
145
|
+
static appProjectsBatchRead(appId: string): string {
|
|
146
|
+
return `${this.appProjectsBatch(appId)}/read`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// POST
|
|
150
|
+
static appProjectsBatchDelete(appId: string): string {
|
|
151
|
+
return `${this.appProjectsBatch(appId)}/delete`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// POST
|
|
155
|
+
static appProjectsBatchUndelete(appId: string): string {
|
|
156
|
+
return `${this.appProjectsBatch(appId)}/undelete`;
|
|
157
|
+
}
|
|
86
158
|
}
|
package/src/runtime/store/Sdk.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { FilesSdk } from './FilesSdk.js';
|
|
|
7
7
|
import { UsersSdk } from './UsersSdk.js';
|
|
8
8
|
import { HistorySdk } from './HistorySdk.js';
|
|
9
9
|
import { SharedSdk } from './SharedSdk.js';
|
|
10
|
+
import { AppSdk } from './AppSdk.js';
|
|
10
11
|
|
|
11
12
|
const baseUriSymbol = Symbol('baseUri');
|
|
12
13
|
|
|
@@ -51,6 +52,11 @@ export abstract class Sdk {
|
|
|
51
52
|
*/
|
|
52
53
|
shared = new SharedSdk(this);
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
* HTTP Client app specific SDK.
|
|
57
|
+
*/
|
|
58
|
+
app = new AppSdk(this);
|
|
59
|
+
|
|
54
60
|
/**
|
|
55
61
|
* When set it limits log output to minimum.
|
|
56
62
|
*/
|
|
@@ -43,7 +43,7 @@ export class SharedSdk extends SdkBase {
|
|
|
43
43
|
err.response = result.body;
|
|
44
44
|
throw err;
|
|
45
45
|
}
|
|
46
|
-
if (!Array.isArray(data.
|
|
46
|
+
if (!Array.isArray(data.items)) {
|
|
47
47
|
const err = new SdkError(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`, 0);
|
|
48
48
|
err.response = result.body;
|
|
49
49
|
throw err;
|
|
@@ -59,7 +59,7 @@ export class UsersSdk extends SdkBase {
|
|
|
59
59
|
} catch (e) {
|
|
60
60
|
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
61
61
|
}
|
|
62
|
-
if (!Array.isArray(data.
|
|
62
|
+
if (!Array.isArray(data.items)) {
|
|
63
63
|
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
64
64
|
}
|
|
65
65
|
return data;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { CookieSameSiteType } from '../../models/HttpCookie.js';
|
|
2
|
-
/**
|
|
3
|
-
* Cookie creation options.
|
|
4
|
-
*/
|
|
5
|
-
export interface CookieOptions {
|
|
6
|
-
'max-age'?: number;
|
|
7
|
-
/**
|
|
8
|
-
* When the cookie expires.
|
|
9
|
-
* Note that this value is parsed to a timestamp in the Cookie class.
|
|
10
|
-
*/
|
|
11
|
-
expires?: Date | number | string;
|
|
12
|
-
/**
|
|
13
|
-
* A string representing the domain the cookie belongs to
|
|
14
|
-
* (e.g. "www.google.com", "example.com")
|
|
15
|
-
*/
|
|
16
|
-
domain?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Cookie path
|
|
19
|
-
*/
|
|
20
|
-
path?: string;
|
|
21
|
-
/**
|
|
22
|
-
* A boolean, `true` if the cookie is marked as secure
|
|
23
|
-
* (i.e. its scope is limited to secure channels, typically HTTPS),
|
|
24
|
-
* or `false` otherwise.
|
|
25
|
-
*/
|
|
26
|
-
secure?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* A boolean, `true` if the cookie is marked as HttpOnly
|
|
29
|
-
* (i.e. the cookie is inaccessible to client-side scripts),
|
|
30
|
-
* or `false` otherwise.
|
|
31
|
-
*/
|
|
32
|
-
httpOnly?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* A boolean, `true` if the cookie is a `host-only` cookie
|
|
35
|
-
* (i.e. the request's host must exactly match the domain of the cookie),
|
|
36
|
-
* or `false` otherwise.
|
|
37
|
-
*/
|
|
38
|
-
hostOnly?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* The SameSite attribute of the Set-Cookie HTTP response header allows you to declare if your cookie should be restricted to a first-party or same-site context.
|
|
41
|
-
*/
|
|
42
|
-
sameSite?: CookieSameSiteType;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* A Cookie object.
|
|
46
|
-
* It is based on https://github.com/pillarjs/cookies/blob/master/lib/cookies.js
|
|
47
|
-
*/
|
|
48
|
-
export declare class Cookie {
|
|
49
|
-
protected _maxAge?: number;
|
|
50
|
-
protected _expires: number;
|
|
51
|
-
protected _domain?: string;
|
|
52
|
-
name: string;
|
|
53
|
-
value: string;
|
|
54
|
-
created: number;
|
|
55
|
-
lastAccess: number;
|
|
56
|
-
persistent?: boolean;
|
|
57
|
-
hostOnly?: boolean;
|
|
58
|
-
path?: string;
|
|
59
|
-
secure?: boolean;
|
|
60
|
-
httpOnly?: boolean;
|
|
61
|
-
sameSite?: CookieSameSiteType;
|
|
62
|
-
/**
|
|
63
|
-
* Constructs a new cookie.
|
|
64
|
-
*
|
|
65
|
-
* @param name Cookie name
|
|
66
|
-
* @param value Cookie value
|
|
67
|
-
* @param opts Additional cookie attributes.
|
|
68
|
-
*/
|
|
69
|
-
constructor(name: string, value?: string, opts?: CookieOptions);
|
|
70
|
-
/**
|
|
71
|
-
* @param max The max age value
|
|
72
|
-
*/
|
|
73
|
-
set maxAge(max: number | undefined);
|
|
74
|
-
/**
|
|
75
|
-
* @return Returns a value of maxAge property
|
|
76
|
-
*/
|
|
77
|
-
get maxAge(): number | undefined;
|
|
78
|
-
get ['max-age'](): number | undefined;
|
|
79
|
-
set ['max-age'](value: number | undefined);
|
|
80
|
-
/**
|
|
81
|
-
* @param expires The value for expires
|
|
82
|
-
*/
|
|
83
|
-
set expires(expires: number | Date | string);
|
|
84
|
-
/**
|
|
85
|
-
* @return the current expires value
|
|
86
|
-
*/
|
|
87
|
-
get expires(): number;
|
|
88
|
-
/**
|
|
89
|
-
* @param domain The cookie domain
|
|
90
|
-
*/
|
|
91
|
-
set domain(domain: string | undefined);
|
|
92
|
-
/**
|
|
93
|
-
* @return The cookie domain
|
|
94
|
-
*/
|
|
95
|
-
get domain(): string | undefined;
|
|
96
|
-
get samesite(): CookieSameSiteType | undefined;
|
|
97
|
-
set samesite(value: CookieSameSiteType | undefined);
|
|
98
|
-
get httponly(): boolean | undefined;
|
|
99
|
-
set httponly(value: boolean | undefined);
|
|
100
|
-
get hostonly(): boolean | undefined;
|
|
101
|
-
set hostonly(value: boolean | undefined);
|
|
102
|
-
/**
|
|
103
|
-
* @return Cookie's `name=value` string.
|
|
104
|
-
*/
|
|
105
|
-
toString(): string;
|
|
106
|
-
/**
|
|
107
|
-
* Returns a Cookie as a HTTP header string.
|
|
108
|
-
* @return Cookie string as a HTTP header value
|
|
109
|
-
*/
|
|
110
|
-
toHeader(): string;
|
|
111
|
-
/**
|
|
112
|
-
* Override toJSON behaviour so it will eliminate
|
|
113
|
-
* all _* properties and replace it with a proper ones.
|
|
114
|
-
*
|
|
115
|
-
* @return {object}
|
|
116
|
-
*/
|
|
117
|
-
toJSON(): Record<string, string>;
|
|
118
|
-
/**
|
|
119
|
-
* Sets value for `expirers` propr from other types.
|
|
120
|
-
* @param expires The value for `expires`
|
|
121
|
-
*/
|
|
122
|
-
setExpires(expires: Date | string | number): void;
|
|
123
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-control-regex */
|
|
2
|
-
const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3
|
-
/**
|
|
4
|
-
* A Cookie object.
|
|
5
|
-
* It is based on https://github.com/pillarjs/cookies/blob/master/lib/cookies.js
|
|
6
|
-
*/
|
|
7
|
-
export class Cookie {
|
|
8
|
-
_maxAge;
|
|
9
|
-
_expires;
|
|
10
|
-
_domain;
|
|
11
|
-
name;
|
|
12
|
-
value;
|
|
13
|
-
created;
|
|
14
|
-
lastAccess;
|
|
15
|
-
persistent;
|
|
16
|
-
hostOnly;
|
|
17
|
-
path;
|
|
18
|
-
secure;
|
|
19
|
-
httpOnly;
|
|
20
|
-
sameSite;
|
|
21
|
-
/**
|
|
22
|
-
* Constructs a new cookie.
|
|
23
|
-
*
|
|
24
|
-
* @param name Cookie name
|
|
25
|
-
* @param value Cookie value
|
|
26
|
-
* @param opts Additional cookie attributes.
|
|
27
|
-
*/
|
|
28
|
-
constructor(name, value = '', opts = {}) {
|
|
29
|
-
if (!fieldContentRegExp.test(name)) {
|
|
30
|
-
throw new TypeError('Argument `name` is invalid');
|
|
31
|
-
}
|
|
32
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
33
|
-
throw new TypeError('Argument `value` is invalid');
|
|
34
|
-
}
|
|
35
|
-
if (opts.path && !fieldContentRegExp.test(opts.path)) {
|
|
36
|
-
throw new TypeError('Option `path` is invalid');
|
|
37
|
-
}
|
|
38
|
-
if (opts.domain && !fieldContentRegExp.test(opts.domain)) {
|
|
39
|
-
throw new TypeError('Option `domain` is invalid');
|
|
40
|
-
}
|
|
41
|
-
this._expires = 0;
|
|
42
|
-
this._domain = undefined;
|
|
43
|
-
this._maxAge = undefined;
|
|
44
|
-
this.name = name;
|
|
45
|
-
this.value = value;
|
|
46
|
-
this.created = Date.now();
|
|
47
|
-
this.lastAccess = this.created;
|
|
48
|
-
if ('max-age' in opts) {
|
|
49
|
-
this.maxAge = opts['max-age'];
|
|
50
|
-
}
|
|
51
|
-
else if (typeof opts.expires !== 'undefined') {
|
|
52
|
-
this.setExpires(opts.expires);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.persistent = false;
|
|
56
|
-
// see http://stackoverflow.com/a/11526569/1127848
|
|
57
|
-
this._expires = new Date(8640000000000000).getTime();
|
|
58
|
-
}
|
|
59
|
-
if ('hostOnly' in opts) {
|
|
60
|
-
this.hostOnly = opts.hostOnly;
|
|
61
|
-
}
|
|
62
|
-
if ('domain' in opts) {
|
|
63
|
-
this.domain = opts.domain;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.hostOnly = false;
|
|
67
|
-
}
|
|
68
|
-
if ('path' in opts) {
|
|
69
|
-
this.path = opts.path;
|
|
70
|
-
}
|
|
71
|
-
if ('secure' in opts) {
|
|
72
|
-
this.secure = opts.secure;
|
|
73
|
-
}
|
|
74
|
-
if ('httpOnly' in opts) {
|
|
75
|
-
this.httpOnly = opts.httpOnly;
|
|
76
|
-
}
|
|
77
|
-
if ('sameSite' in opts) {
|
|
78
|
-
this.sameSite = opts.sameSite;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @param max The max age value
|
|
83
|
-
*/
|
|
84
|
-
set maxAge(max) {
|
|
85
|
-
const typedMax = Number(max);
|
|
86
|
-
if (Number.isNaN(typedMax)) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this._maxAge = typedMax;
|
|
90
|
-
if (typedMax <= 0) {
|
|
91
|
-
// see http://stackoverflow.com/a/11526569/1127848
|
|
92
|
-
// and https://tools.ietf.org/html/rfc6265#section-5.2.2
|
|
93
|
-
this._expires = new Date(-8640000000000000).getTime();
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
let now = Date.now();
|
|
97
|
-
now += typedMax * 1000;
|
|
98
|
-
this._expires = now;
|
|
99
|
-
}
|
|
100
|
-
this.persistent = true;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* @return Returns a value of maxAge property
|
|
104
|
-
*/
|
|
105
|
-
get maxAge() {
|
|
106
|
-
return this._maxAge;
|
|
107
|
-
}
|
|
108
|
-
get ['max-age']() {
|
|
109
|
-
return this.maxAge;
|
|
110
|
-
}
|
|
111
|
-
set ['max-age'](value) {
|
|
112
|
-
this.maxAge = value;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @param expires The value for expires
|
|
116
|
-
*/
|
|
117
|
-
set expires(expires) {
|
|
118
|
-
const any = expires;
|
|
119
|
-
if ((expires && typeof any === 'string') || any instanceof Date) {
|
|
120
|
-
this.setExpires(any);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
this._expires = expires;
|
|
124
|
-
this.persistent = true;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @return the current expires value
|
|
128
|
-
*/
|
|
129
|
-
get expires() {
|
|
130
|
-
return this._expires;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @param domain The cookie domain
|
|
134
|
-
*/
|
|
135
|
-
set domain(domain) {
|
|
136
|
-
this._domain = domain;
|
|
137
|
-
if (!domain) {
|
|
138
|
-
this.hostOnly = false;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
this.hostOnly = true;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @return The cookie domain
|
|
146
|
-
*/
|
|
147
|
-
get domain() {
|
|
148
|
-
return this._domain;
|
|
149
|
-
}
|
|
150
|
-
get samesite() {
|
|
151
|
-
return this.sameSite;
|
|
152
|
-
}
|
|
153
|
-
set samesite(value) {
|
|
154
|
-
this.sameSite = value;
|
|
155
|
-
}
|
|
156
|
-
get httponly() {
|
|
157
|
-
return this.httpOnly;
|
|
158
|
-
}
|
|
159
|
-
set httponly(value) {
|
|
160
|
-
this.httpOnly = value;
|
|
161
|
-
}
|
|
162
|
-
get hostonly() {
|
|
163
|
-
return this.hostOnly;
|
|
164
|
-
}
|
|
165
|
-
set hostonly(value) {
|
|
166
|
-
this.hostOnly = value;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* @return Cookie's `name=value` string.
|
|
170
|
-
*/
|
|
171
|
-
toString() {
|
|
172
|
-
const { name, value } = this;
|
|
173
|
-
return `${name}=${value}`;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Returns a Cookie as a HTTP header string.
|
|
177
|
-
* @return Cookie string as a HTTP header value
|
|
178
|
-
*/
|
|
179
|
-
toHeader() {
|
|
180
|
-
let header = this.toString();
|
|
181
|
-
let expires;
|
|
182
|
-
if (this._expires) {
|
|
183
|
-
expires = new Date(this._expires);
|
|
184
|
-
if (expires.toString() === 'Invalid Date') {
|
|
185
|
-
expires = new Date(0);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (expires) {
|
|
189
|
-
header += `; expires=${expires.toUTCString()}`;
|
|
190
|
-
}
|
|
191
|
-
const { path, domain, httpOnly, sameSite, secure } = this;
|
|
192
|
-
if (path) {
|
|
193
|
-
header += `; path=${path}`;
|
|
194
|
-
}
|
|
195
|
-
if (domain) {
|
|
196
|
-
header += `; domain=${domain}`;
|
|
197
|
-
}
|
|
198
|
-
if (httpOnly) {
|
|
199
|
-
header += `; httpOnly=${httpOnly}`;
|
|
200
|
-
}
|
|
201
|
-
if (sameSite) {
|
|
202
|
-
header += `; SameSite=${sameSite}`;
|
|
203
|
-
}
|
|
204
|
-
if (secure) {
|
|
205
|
-
header += `; Secure`;
|
|
206
|
-
}
|
|
207
|
-
return header;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Override toJSON behaviour so it will eliminate
|
|
211
|
-
* all _* properties and replace it with a proper ones.
|
|
212
|
-
*
|
|
213
|
-
* @return {object}
|
|
214
|
-
*/
|
|
215
|
-
toJSON() {
|
|
216
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
217
|
-
const copy = {};
|
|
218
|
-
const keys = Object.keys(this);
|
|
219
|
-
keys.forEach((key) => {
|
|
220
|
-
if (key.indexOf('_') === 0) {
|
|
221
|
-
const realKey = key.substring(1);
|
|
222
|
-
copy[realKey] = this[key];
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
copy[key] = this[key];
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
return copy;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Sets value for `expirers` propr from other types.
|
|
232
|
-
* @param expires The value for `expires`
|
|
233
|
-
*/
|
|
234
|
-
setExpires(expires) {
|
|
235
|
-
let value;
|
|
236
|
-
if (expires instanceof Date) {
|
|
237
|
-
value = expires.getTime();
|
|
238
|
-
}
|
|
239
|
-
else if (typeof expires === 'string') {
|
|
240
|
-
const tmp = new Date(expires);
|
|
241
|
-
if (tmp.toString() === 'Invalid Date') {
|
|
242
|
-
value = 0;
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
value = tmp.getTime();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
else if (typeof expires === 'number') {
|
|
249
|
-
value = expires;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
value = 0;
|
|
253
|
-
}
|
|
254
|
-
this.expires = value;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
//# sourceMappingURL=Cookie.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Cookie.js","sourceRoot":"","sources":["../../../../src/lib/cookies/Cookie.ts"],"names":[],"mappings":"AA6CA,qCAAqC;AACrC,MAAM,kBAAkB,GAAG,uCAAuC,CAAC;AAEnE;;;GAGG;AACH,MAAM,OAAO,MAAM;IACP,OAAO,CAAU;IACjB,QAAQ,CAAS;IACjB,OAAO,CAAU;IAC3B,IAAI,CAAS;IACb,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,UAAU,CAAW;IACrB,QAAQ,CAAW;IACnB,IAAI,CAAU;IACd,MAAM,CAAW;IACjB,QAAQ,CAAW;IACnB,QAAQ,CAAsB;IAE9B;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,KAAK,GAAG,EAAE,EAAE,OAAsB,EAAE;QAC5D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAClC,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;SACnD;QACD,IAAI,KAAK,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5C,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACpD;QACD,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpD,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;SACjD;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC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,IAAI,CAAC,GAAG,CAAC,CAAC;aACvB;QACH,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,OAA+B;QACxC,IAAI,KAAa,CAAC;QAClB,IAAI,OAAO,YAAY,IAAI,EAAE;YAC3B,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;SAC3B;aAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YACtC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,IAAI,GAAG,CAAC,QAAQ,EAAE,KAAK,cAAc,EAAE;gBACrC,KAAK,GAAG,CAAC,CAAC;aACX;iBAAM;gBACL,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;aACvB;SACF;aAAM,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YACtC,KAAK,GAAG,OAAO,CAAC;SACjB;aAAM;YACL,KAAK,GAAG,CAAC,CAAC;SACX;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Cookie, CookieOptions } from './Cookie.js';
|
|
2
|
-
export declare const urlSymbol: unique symbol;
|
|
3
|
-
/**
|
|
4
|
-
* A library to handle Cookie parsing.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Cookies {
|
|
7
|
-
cookies: Cookie[];
|
|
8
|
-
uri: URL | undefined;
|
|
9
|
-
[urlSymbol]: string | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* Constructs an object.
|
|
12
|
-
*
|
|
13
|
-
* @param header A HTTP cookie string to parse.
|
|
14
|
-
* @param url A request url for this cookie. If empty some cookie computations (like checking if cookies matches) will be omitted.
|
|
15
|
-
*/
|
|
16
|
-
constructor(header?: string, url?: string);
|
|
17
|
-
/**
|
|
18
|
-
* Set's the URL and parses it setting `uri` property.
|
|
19
|
-
* @param url Cookie URL
|
|
20
|
-
*/
|
|
21
|
-
set url(url: string | undefined);
|
|
22
|
-
/**
|
|
23
|
-
* @returns {string} Cookie URL
|
|
24
|
-
*/
|
|
25
|
-
get url(): string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Parses a cookie string to a list of Cookie objects.
|
|
28
|
-
*
|
|
29
|
-
* @param cookies A HTTP cookie string
|
|
30
|
-
* @returns List of parsed cookies.
|
|
31
|
-
*/
|
|
32
|
-
static parse(cookies: string): Cookie[];
|
|
33
|
-
/**
|
|
34
|
-
* Get a cookie by name.
|
|
35
|
-
*
|
|
36
|
-
* @param name Cookie name
|
|
37
|
-
* @returns A Cookie object or null.
|
|
38
|
-
*/
|
|
39
|
-
get(name: string): Cookie | null;
|
|
40
|
-
/**
|
|
41
|
-
* Adds a cookie to the list of cookies.
|
|
42
|
-
*
|
|
43
|
-
* @param name Name of the cookie.
|
|
44
|
-
* @param value Value of the cookie.
|
|
45
|
-
* @param opts Other cookie options to set.
|
|
46
|
-
*/
|
|
47
|
-
set(name: string, value?: string, opts?: CookieOptions): void;
|
|
48
|
-
/**
|
|
49
|
-
* Returns a string that can be used in a HTTP header value for Cookie.
|
|
50
|
-
* The structure of the cookie string depends on if you want to send a
|
|
51
|
-
* cookie from the server to client or other way around.
|
|
52
|
-
* When you want to send the `Cookie` header to server set
|
|
53
|
-
* `toServer` argument to true. Then it will produce only `name=value;`
|
|
54
|
-
* string. Otherwise it will be the `Set-Cookie` header value
|
|
55
|
-
* containing all other cookies properties.
|
|
56
|
-
*
|
|
57
|
-
* @param toServer True if produced string is to be used with the `Cookie` header
|
|
58
|
-
* @returns HTTP header string value for all cookies.
|
|
59
|
-
*/
|
|
60
|
-
toString(toServer?: boolean): string;
|
|
61
|
-
/**
|
|
62
|
-
* Removes cookies from `this.cookies` that has been set for different
|
|
63
|
-
* domain and path.
|
|
64
|
-
* This function has no effect if the URL is not set.
|
|
65
|
-
*
|
|
66
|
-
* This function follows an algorithm defined in https://tools.ietf.org/html/rfc6265 for
|
|
67
|
-
* domain match.
|
|
68
|
-
*
|
|
69
|
-
* @returns A list of removed cookies.
|
|
70
|
-
*/
|
|
71
|
-
filter(): Cookie[];
|
|
72
|
-
/**
|
|
73
|
-
* Merges this cookies with another Cookies object.
|
|
74
|
-
* This cookies will be overwritten by passed cookies according to
|
|
75
|
-
* the HTTP spec.
|
|
76
|
-
* This function is useful when you need to override cookies with
|
|
77
|
-
* the response from the server
|
|
78
|
-
* as defined in the https://tools.ietf.org/html/rfc6265.
|
|
79
|
-
*
|
|
80
|
-
* @param cookies An Cookies object with newest cookies.
|
|
81
|
-
* @param copyKeys When set, it copies values for given keys from old object to the new one.
|
|
82
|
-
*/
|
|
83
|
-
merge(cookies: Cookies, copyKeys?: (keyof Cookie)[]): void;
|
|
84
|
-
/**
|
|
85
|
-
* Clears cookies from `this.cookies` that already expired.
|
|
86
|
-
*
|
|
87
|
-
* @returns List of removed (expired) cookies.
|
|
88
|
-
*/
|
|
89
|
-
clearExpired(): Cookie[];
|
|
90
|
-
}
|