jsf.js_next_gen 4.0.1-beta.9 → 4.0.2-beta.2
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/dist/window/faces-development.js +12 -2
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +12 -2
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +1 -1
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +2 -2
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +11 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +22 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -1
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +45 -0
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +3 -3
- package/target/impl/util/HiddenInputBuilder.js +2 -2
- package/target/impl/util/HiddenInputBuilder.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +10 -0
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +20 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +2 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +36 -0
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +3 -3
- package/target/AssocArray.js +0 -281
- package/target/AssocArray.js.map +0 -1
- package/target/Config.js +0 -235
- package/target/Config.js.map +0 -1
- package/target/CryptoExtensions.js +0 -112
- package/target/CryptoExtensions.js.map +0 -1
- package/target/DomQuery.js +0 -1963
- package/target/DomQuery.js.map +0 -1
- package/target/Es2019Array.js +0 -117
- package/target/Es2019Array.js.map +0 -1
- package/target/Global.js +0 -38
- package/target/Global.js.map +0 -1
- package/target/IDomQuery.js +0 -3
- package/target/IDomQuery.js.map +0 -1
- package/target/Lang.js +0 -183
- package/target/Lang.js.map +0 -1
- package/target/Messaging.js +0 -645
- package/target/Messaging.js.map +0 -1
- package/target/Monad.js +0 -330
- package/target/Monad.js.map +0 -1
- package/target/Promise.js +0 -296
- package/target/Promise.js.map +0 -1
- package/target/PromiseShim.js +0 -30
- package/target/PromiseShim.js.map +0 -1
- package/target/SourcesCollectors.js +0 -444
- package/target/SourcesCollectors.js.map +0 -1
- package/target/Stream.js +0 -562
- package/target/Stream.js.map +0 -1
- package/target/TagBuilder.js +0 -178
- package/target/TagBuilder.js.map +0 -1
- package/target/XmlQuery.js +0 -84
- package/target/XmlQuery.js.map +0 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/core/Context.js +0 -10
- package/target/impl/core/Context.js.map +0 -1
- package/target/impl/util/AsyncQueue.js +0 -109
- package/target/impl/util/AsyncQueue.js.map +0 -1
- package/target/impl/util/HiddenElementBuilder.js +0 -7
- package/target/impl/util/HiddenElementBuilder.js.map +0 -1
- package/target/impl/util/IAsyncRunnable.js +0 -27
- package/target/impl/util/IAsyncRunnable.js.map +0 -1
- package/target/impl/util/URLCodec.js +0 -77
- package/target/impl/util/URLCodec.js.map +0 -1
- package/target/impl/xhrCore/RequestContext.js +0 -11
- package/target/impl/xhrCore/RequestContext.js.map +0 -1
- package/target/impl/xhrCore/XhrQueHandler.js +0 -11
- package/target/impl/xhrCore/XhrQueHandler.js.map +0 -1
- package/target/impl/xhrCore/XhrQueueController.js +0 -62
- package/target/impl/xhrCore/XhrQueueController.js.map +0 -1
- package/target/index.js +0 -80
- package/target/index.js.map +0 -1
- package/target/index_core.js +0 -76
- package/target/index_core.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +0 -76
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +0 -178
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +0 -1
- package/target/test/myfaces/OnLoadSpec.js +0 -57
- package/target/test/myfaces/OnLoadSpec.js.map +0 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +0 -24
- package/target/test-classes/jsf-development.js +0 -3559
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +0 -1
- package/target/test-classes/jsf.js +0 -3
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/target/types/main/typescript/AssocArray.d.ts +0 -86
- package/target/types/main/typescript/Config.d.ts +0 -94
- package/target/types/main/typescript/CryptoExtensions.d.ts +0 -87
- package/target/types/main/typescript/DomQuery.d.ts +0 -587
- package/target/types/main/typescript/Es2019Array.d.ts +0 -30
- package/target/types/main/typescript/Global.d.ts +0 -23
- package/target/types/main/typescript/IDomQuery.d.ts +0 -480
- package/target/types/main/typescript/Lang.d.ts +0 -97
- package/target/types/main/typescript/Messaging.d.ts +0 -285
- package/target/types/main/typescript/Monad.d.ts +0 -161
- package/target/types/main/typescript/Promise.d.ts +0 -58
- package/target/types/main/typescript/PromiseShim.d.ts +0 -22
- package/target/types/main/typescript/SourcesCollectors.d.ts +0 -280
- package/target/types/main/typescript/Stream.d.ts +0 -284
- package/target/types/main/typescript/TagBuilder.d.ts +0 -50
- package/target/types/main/typescript/XmlQuery.d.ts +0 -31
- package/target/types/main/typescript/api/_api.d.ts +0 -182
- package/target/types/main/typescript/api/faces.d.ts +0 -17
- package/target/types/main/typescript/api/jsf.d.ts +0 -17
- package/target/types/main/typescript/impl/AjaxImpl.d.ts +0 -164
- package/target/types/main/typescript/impl/PushImpl.d.ts +0 -38
- package/target/types/main/typescript/impl/core/Const.d.ts +0 -138
- package/target/types/main/typescript/impl/core/ImplTypes.d.ts +0 -16
- package/target/types/main/typescript/impl/i18n/Messages.d.ts +0 -102
- package/target/types/main/typescript/impl/util/Assertions.d.ts +0 -46
- package/target/types/main/typescript/impl/util/AsyncRunnable.d.ts +0 -112
- package/target/types/main/typescript/impl/util/ExtDomQuery.d.ts +0 -100
- package/target/types/main/typescript/impl/util/FileUtils.d.ts +0 -25
- package/target/types/main/typescript/impl/util/HiddenInputBuilder.d.ts +0 -37
- package/target/types/main/typescript/impl/util/IListener.d.ts +0 -18
- package/target/types/main/typescript/impl/util/Lang.d.ts +0 -138
- package/target/types/main/typescript/impl/util/XhrQueueController.d.ts +0 -51
- package/target/types/main/typescript/impl/xhrCore/ErrorData.d.ts +0 -37
- package/target/types/main/typescript/impl/xhrCore/EventData.d.ts +0 -25
- package/target/types/main/typescript/impl/xhrCore/IResponseProcessor.d.ts +0 -136
- package/target/types/main/typescript/impl/xhrCore/RequestDataResolver.d.ts +0 -84
- package/target/types/main/typescript/impl/xhrCore/ResonseDataResolver.d.ts +0 -60
- package/target/types/main/typescript/impl/xhrCore/Response.d.ts +0 -29
- package/target/types/main/typescript/impl/xhrCore/ResponseProcessor.d.ts +0 -208
- package/target/types/main/typescript/impl/xhrCore/XhrFormData.d.ts +0 -83
- package/target/types/main/typescript/impl/xhrCore/XhrRequest.d.ts +0 -102
- package/target/types/main/typescript/index.d.ts +0 -34
- package/target/types/main/typescript/index_core.d.ts +0 -29
- package/target/types/main/typescript/myfaces/OamSubmit.d.ts +0 -53
- package/target/types/main/typescript/test/frameworkBase/LangTest.spec.d.ts +0 -1
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.d.ts +0 -1
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.d.ts +0 -39
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.d.ts +0 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.d.ts +0 -1
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.d.ts +0 -1
- package/target/types/main/typescript/test/frameworkBase/_ext/shared/StandardInits.d.ts +0 -63
- package/target/types/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.d.ts +0 -23
- package/target/types/main/typescript/test/impl/ImplTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/impl/ImplTest_23.spec.d.ts +0 -16
- package/target/types/main/typescript/test/impl/SeparatorCharsTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/myfaces/OamSubmit.spec.d.ts +0 -16
- package/target/types/main/typescript/test/myfaces/OnLoad.spec.d.ts +0 -16
- package/target/types/main/typescript/test/queue/AsynchronousProbe.d.ts +0 -38
- package/target/types/main/typescript/test/queue/AsynchronousQueueTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/ClientWindow.spec.d.ts +0 -1
- package/target/types/main/typescript/test/xhrCore/ErrorChainTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/EventTests.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/FakeWebsocket.d.ts +0 -24
- package/target/types/main/typescript/test/xhrCore/FileUploadTest.spec.d.ts +0 -1
- package/target/types/main/typescript/test/xhrCore/NamespacesRequestTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/OamSubmitTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/RequestParamsTest.spec.d.ts +0 -1
- package/target/types/main/typescript/test/xhrCore/RequestTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/RequestTest_23.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/ResponseTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/ResponseTest23.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/ShadowDomTest.spec.d.ts +0 -16
- package/target/types/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.d.ts +0 -1
- package/target/types/main/typescript/test/xhrCore/WebsocketTest.d.ts +0 -1
- package/target/types/main/typescript/test/xhrCore/XhrFormDataTest.spec.d.ts +0 -16
- package/target/types/test/typescript/AssocArrayTest.spec.d.ts +0 -1
- package/target/types/test/typescript/DomQueryTest.spec.d.ts +0 -1
- package/target/types/test/typescript/ExtendedArrayTest.spec.d.ts +0 -1
- package/target/types/test/typescript/LangTest.spec.d.ts +0 -1
- package/target/types/test/typescript/MappingProbes.d.ts +0 -24
- package/target/types/test/typescript/MappingTest.spec.d.ts +0 -1
- package/target/types/test/typescript/MessagingTest.spec.d.ts +0 -1
- package/target/types/test/typescript/MonadTest.spec.d.ts +0 -16
- package/target/types/test/typescript/PromiseTest.spec.d.ts +0 -1
- package/target/types/test/typescript/StreamTest.spec.d.ts +0 -1
- package/target/types/test/typescript/XmlQueryTest.spec.d.ts +0 -1
- package/target/types/test/typescript/markups/tobago-with-header.d.ts +0 -1
- package/target/types/test/typescript/markups/tobago-without-header.d.ts +0 -1
package/target/Monad.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
4
|
-
* contributor license agreements. See the NOTICE file distributed with
|
|
5
|
-
* this work for additional information regarding copyright ownership.
|
|
6
|
-
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
7
|
-
* (the "License"); you may not use this file except in compliance with
|
|
8
|
-
* the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
|
|
20
|
-
const Es2019Array_1 = require("./Es2019Array");
|
|
21
|
-
/**
|
|
22
|
-
* Implementation of a monad
|
|
23
|
-
* (Side - effect free), no write allowed directly on the monads
|
|
24
|
-
* value state
|
|
25
|
-
*/
|
|
26
|
-
class Monad {
|
|
27
|
-
constructor(value) {
|
|
28
|
-
this._value = value;
|
|
29
|
-
}
|
|
30
|
-
get value() {
|
|
31
|
-
return this._value;
|
|
32
|
-
}
|
|
33
|
-
map(fn) {
|
|
34
|
-
if (!fn) {
|
|
35
|
-
fn = (inVal) => inVal;
|
|
36
|
-
}
|
|
37
|
-
let result = fn(this.value);
|
|
38
|
-
return new Monad(result);
|
|
39
|
-
}
|
|
40
|
-
flatMap(fn) {
|
|
41
|
-
let mapped = this.map(fn);
|
|
42
|
-
while ((mapped === null || mapped === void 0 ? void 0 : mapped.value) instanceof Monad) {
|
|
43
|
-
mapped = mapped.value;
|
|
44
|
-
}
|
|
45
|
-
return mapped;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.Monad = Monad;
|
|
49
|
-
/**
|
|
50
|
-
* optional implementation, an optional is basically an implementation of a Monad with additional syntactic
|
|
51
|
-
* sugar on top
|
|
52
|
-
* (Side - effect free, since value assignment is not allowed)
|
|
53
|
-
* */
|
|
54
|
-
class Optional extends Monad {
|
|
55
|
-
constructor(value) {
|
|
56
|
-
super(value);
|
|
57
|
-
}
|
|
58
|
-
get value() {
|
|
59
|
-
if (this._value instanceof Monad) {
|
|
60
|
-
return this._value.flatMap().value;
|
|
61
|
-
}
|
|
62
|
-
return this._value;
|
|
63
|
-
}
|
|
64
|
-
static fromNullable(value) {
|
|
65
|
-
return new Optional(value);
|
|
66
|
-
}
|
|
67
|
-
/*syntactic sugar for absent and present checks*/
|
|
68
|
-
isAbsent() {
|
|
69
|
-
return "undefined" == typeof this.value || null == this.value;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* any value present
|
|
73
|
-
*/
|
|
74
|
-
isPresent(presentRunnable) {
|
|
75
|
-
let absent = this.isAbsent();
|
|
76
|
-
if (!absent && presentRunnable) {
|
|
77
|
-
presentRunnable.call(this, this);
|
|
78
|
-
}
|
|
79
|
-
return !absent;
|
|
80
|
-
}
|
|
81
|
-
ifPresentLazy(presentRunnable = () => {
|
|
82
|
-
}) {
|
|
83
|
-
this.isPresent.call(this, presentRunnable);
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
orElse(elseValue) {
|
|
87
|
-
if (this.isPresent()) {
|
|
88
|
-
return this;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
//shortcut
|
|
92
|
-
if (elseValue == null) {
|
|
93
|
-
return Optional.absent;
|
|
94
|
-
}
|
|
95
|
-
return this.flatMap(() => elseValue);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* lazy, passes a function which then is lazily evaluated
|
|
100
|
-
* instead of a direct value
|
|
101
|
-
* @param func
|
|
102
|
-
*/
|
|
103
|
-
orElseLazy(func) {
|
|
104
|
-
if (this.isPresent()) {
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
return this.flatMap(func);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/*
|
|
112
|
-
* we need to implement it to fulfill the contract, although it is used only internally
|
|
113
|
-
* all values are flattened when accessed anyway, so there is no need to call this method
|
|
114
|
-
*/
|
|
115
|
-
flatMap(fn) {
|
|
116
|
-
let val = super.flatMap(fn);
|
|
117
|
-
if (!(val instanceof Optional)) {
|
|
118
|
-
return Optional.fromNullable(val.value);
|
|
119
|
-
}
|
|
120
|
-
return val.flatMap();
|
|
121
|
-
}
|
|
122
|
-
/*
|
|
123
|
-
* elvis operation, take care, if you use this you lose typesafety and refactoring
|
|
124
|
-
* capabilities, unfortunately typescript does not allow to have its own elvis operator
|
|
125
|
-
* this is some syntactic sugar however which is quite useful*/
|
|
126
|
-
getIf(...key) {
|
|
127
|
-
key = this.preprocessKeys(...key);
|
|
128
|
-
let currentPos = this;
|
|
129
|
-
for (let cnt = 0; cnt < key.length; cnt++) {
|
|
130
|
-
let currKey = this.keyVal(key[cnt]);
|
|
131
|
-
let arrPos = this.arrayIndex(key[cnt]);
|
|
132
|
-
if (currKey === "" && arrPos >= 0) {
|
|
133
|
-
currentPos = this.getClass().fromNullable(!(currentPos.value instanceof Array) ? null : (currentPos.value.length < arrPos ? null : currentPos.value[arrPos]));
|
|
134
|
-
if (currentPos.isAbsent()) {
|
|
135
|
-
return currentPos;
|
|
136
|
-
}
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
else if (currKey && arrPos >= 0) {
|
|
140
|
-
if (currentPos.getIfPresent(currKey).isAbsent()) {
|
|
141
|
-
return currentPos;
|
|
142
|
-
}
|
|
143
|
-
currentPos = (currentPos.getIfPresent(currKey).value instanceof Array) ? this.getClass().fromNullable(currentPos.getIfPresent(currKey).value[arrPos]) : this.getClass().absent;
|
|
144
|
-
if (currentPos.isAbsent()) {
|
|
145
|
-
return currentPos;
|
|
146
|
-
}
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
currentPos = currentPos.getIfPresent(currKey);
|
|
151
|
-
}
|
|
152
|
-
if (currentPos.isAbsent()) {
|
|
153
|
-
return currentPos;
|
|
154
|
-
}
|
|
155
|
-
else if (arrPos > -1) {
|
|
156
|
-
currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return currentPos;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* simple match, if the first order function call returns
|
|
163
|
-
* true then there is a match, if the value is not present
|
|
164
|
-
* it never matches
|
|
165
|
-
*
|
|
166
|
-
* @param fn the first order function performing the match
|
|
167
|
-
*/
|
|
168
|
-
match(fn) {
|
|
169
|
-
if (this.isAbsent()) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
return fn(this.value);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* convenience function to flatmap the internal value
|
|
176
|
-
* and replace it with a default in case of being absent
|
|
177
|
-
*
|
|
178
|
-
* @param defaultVal
|
|
179
|
-
* @returns {Optional<any>}
|
|
180
|
-
*/
|
|
181
|
-
get(defaultVal = Optional.absent) {
|
|
182
|
-
if (this.isAbsent()) {
|
|
183
|
-
return this.getClass().fromNullable(defaultVal).flatMap();
|
|
184
|
-
}
|
|
185
|
-
return this.getClass().fromNullable(this.value).flatMap();
|
|
186
|
-
}
|
|
187
|
-
toJson() {
|
|
188
|
-
return JSON.stringify(this.value);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* helper to override several implementations in a more fluent way
|
|
192
|
-
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
193
|
-
* static methods and do not have to implement several methods which rely on the type
|
|
194
|
-
* of "this"
|
|
195
|
-
* @returns the type of Optional
|
|
196
|
-
*/
|
|
197
|
-
getClass() {
|
|
198
|
-
return Optional;
|
|
199
|
-
}
|
|
200
|
-
/*helper method for getIf with array access aka <name>[<indexPos>]*/
|
|
201
|
-
arrayIndex(key) {
|
|
202
|
-
let start = key.indexOf("[");
|
|
203
|
-
let end = key.indexOf("]");
|
|
204
|
-
if (start >= 0 && end > 0 && start < end) {
|
|
205
|
-
return parseInt(key.substring(start + 1, end));
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
return -1;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
/*helper method for getIf with array access aka <name>[<indexPos>]*/
|
|
212
|
-
keyVal(key) {
|
|
213
|
-
let start = key.indexOf("[");
|
|
214
|
-
if (start >= 0) {
|
|
215
|
-
return key.substring(0, start);
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
return key;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* additional syntactic sugar which is not part of the usual optional implementation
|
|
223
|
-
* but makes life easier, if you want to sacrifice typesafety and refactoring
|
|
224
|
-
* capabilities in typescript
|
|
225
|
-
*/
|
|
226
|
-
getIfPresent(key) {
|
|
227
|
-
if (this.isAbsent()) {
|
|
228
|
-
return this.getClass().absent;
|
|
229
|
-
}
|
|
230
|
-
return this.getClass().fromNullable(this.value[key]).flatMap();
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* elvis like typesafe functional save resolver
|
|
234
|
-
* a typesafe option for getIfPresent
|
|
235
|
-
*
|
|
236
|
-
* usage myOptional.resolve(value => value.subAttr.subAttr2).orElseLazy(....)
|
|
237
|
-
* if this is resolvable without any errors an Optional with the value is returned
|
|
238
|
-
* if not, then an Optional absent is returned, also if you return Optional absent
|
|
239
|
-
* it is flatmapped into absent
|
|
240
|
-
*
|
|
241
|
-
* @param resolver the resolver function, can throw any arbitrary errors, int the error case
|
|
242
|
-
* the resolution goes towards absent
|
|
243
|
-
*/
|
|
244
|
-
resolve(resolver) {
|
|
245
|
-
if (this.isAbsent()) {
|
|
246
|
-
return Optional.absent;
|
|
247
|
-
}
|
|
248
|
-
try {
|
|
249
|
-
return Optional.fromNullable(resolver(this.value));
|
|
250
|
-
}
|
|
251
|
-
catch (e) {
|
|
252
|
-
return Optional.absent;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
preprocessKeys(...keys) {
|
|
256
|
-
return new Es2019Array_1.Es2019Array(...keys)
|
|
257
|
-
.flatMap(item => {
|
|
258
|
-
return new Es2019Array_1.Es2019Array(...item.split(/]\s*\[/gi))
|
|
259
|
-
.map(item => {
|
|
260
|
-
item = item.replace(/^\s+|\s+$/g, "");
|
|
261
|
-
if (item.indexOf("[") == -1 && item.indexOf("]") != -1) {
|
|
262
|
-
item = "[" + item;
|
|
263
|
-
}
|
|
264
|
-
if (item.indexOf("]") == -1 && item.indexOf("[") != -1) {
|
|
265
|
-
item = item + "]";
|
|
266
|
-
}
|
|
267
|
-
return item;
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
exports.Optional = Optional;
|
|
273
|
-
/*default value for absent*/
|
|
274
|
-
Optional.absent = Optional.fromNullable(null);
|
|
275
|
-
// --------------------- From here onwards we break out the side effect free limits ------------
|
|
276
|
-
/**
|
|
277
|
-
* ValueEmbedder is the writeable version
|
|
278
|
-
* of optional, it basically is a wrapper
|
|
279
|
-
* around a construct which has a state
|
|
280
|
-
* and can be written to.
|
|
281
|
-
*
|
|
282
|
-
* For the readonly version see Optional
|
|
283
|
-
*/
|
|
284
|
-
class ValueEmbedder extends Optional {
|
|
285
|
-
constructor(rootElem, valueKey = "value") {
|
|
286
|
-
super(rootElem);
|
|
287
|
-
this.key = valueKey;
|
|
288
|
-
}
|
|
289
|
-
get value() {
|
|
290
|
-
return this._value ? this._value[this.key] : null;
|
|
291
|
-
}
|
|
292
|
-
set value(newVal) {
|
|
293
|
-
if (!this._value) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
this._value[this.key] = newVal;
|
|
297
|
-
}
|
|
298
|
-
orElse(elseValue) {
|
|
299
|
-
let alternative = {};
|
|
300
|
-
alternative[this.key] = elseValue;
|
|
301
|
-
return this.isPresent() ? this : new ValueEmbedder(alternative, this.key);
|
|
302
|
-
}
|
|
303
|
-
orElseLazy(func) {
|
|
304
|
-
if (this.isPresent()) {
|
|
305
|
-
return this;
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
let alternative = {};
|
|
309
|
-
alternative[this.key] = func();
|
|
310
|
-
return new ValueEmbedder(alternative, this.key);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* helper to override several implementations in a more fluent way
|
|
315
|
-
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
316
|
-
* static methods and do not have to implement several methods which rely on the type
|
|
317
|
-
* of "this"
|
|
318
|
-
* @returns ValueEmbedder
|
|
319
|
-
*/
|
|
320
|
-
getClass() {
|
|
321
|
-
return ValueEmbedder;
|
|
322
|
-
}
|
|
323
|
-
static fromNullable(value, valueKey = "value") {
|
|
324
|
-
return new ValueEmbedder(value, valueKey);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
exports.ValueEmbedder = ValueEmbedder;
|
|
328
|
-
/*default value for absent*/
|
|
329
|
-
ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
|
|
330
|
-
//# sourceMappingURL=Monad.js.map
|
package/target/Monad.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Monad.js","sourceRoot":"","sources":["../src/main/typescript/Monad.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAUH,+CAA0C;AA0C1C;;;;GAIG;AACH,MAAa,KAAK;IACd,YAAY,KAAQ;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAID,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,GAAG,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AE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9E,CAAC;IAED,UAAU,CAAC,IAAe;QACtB,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE;YAClB,OAAO,IAAI,CAAC;SACf;aAAM;YACH,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC;YAC/B,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACnD;IACL,CAAC;IAED;;;;;;OAMG;IACO,QAAQ;QACd,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,YAAY,CAA0B,KAAW,EAAE,WAAmB,OAAO;QAChF,OAAa,IAAI,aAAa,CAAI,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;;AArDL,sCAuDC;AArDG,4BAA4B;AACrB,oBAAM,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC"}
|
package/target/Promise.js
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CancellablePromise = exports.Promise = exports.interval = exports.timeout = exports.PromiseStatus = void 0;
|
|
4
|
-
/*!
|
|
5
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
|
6
|
-
* or more contributor license agreements. See the NOTICE file
|
|
7
|
-
* distributed with this work for additional information
|
|
8
|
-
* regarding copyright ownership. The ASF licenses this file
|
|
9
|
-
* to you under the Apache License, Version 2.0 (the
|
|
10
|
-
* "License"); you may not use this file except in compliance
|
|
11
|
-
* with the License. You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing,
|
|
16
|
-
* software distributed under the License is distributed on an
|
|
17
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
18
|
-
* KIND, either express or implied. See the License for the
|
|
19
|
-
* specific language governing permissions and limitations
|
|
20
|
-
* under the License.
|
|
21
|
-
*/
|
|
22
|
-
const Monad_1 = require("./Monad");
|
|
23
|
-
var PromiseStatus;
|
|
24
|
-
(function (PromiseStatus) {
|
|
25
|
-
PromiseStatus[PromiseStatus["PENDING"] = 0] = "PENDING";
|
|
26
|
-
PromiseStatus[PromiseStatus["FULLFILLED"] = 1] = "FULLFILLED";
|
|
27
|
-
PromiseStatus[PromiseStatus["REJECTED"] = 2] = "REJECTED";
|
|
28
|
-
})(PromiseStatus = exports.PromiseStatus || (exports.PromiseStatus = {}));
|
|
29
|
-
/*
|
|
30
|
-
* Promise wrappers for timeout and interval
|
|
31
|
-
*/
|
|
32
|
-
function timeout(timeout) {
|
|
33
|
-
let handler = null;
|
|
34
|
-
return new CancellablePromise((apply, reject) => {
|
|
35
|
-
handler = setTimeout(() => apply(), timeout);
|
|
36
|
-
}, () => {
|
|
37
|
-
if (handler) {
|
|
38
|
-
clearTimeout(handler);
|
|
39
|
-
handler = null;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
exports.timeout = timeout;
|
|
44
|
-
function interval(timeout) {
|
|
45
|
-
let handler = null;
|
|
46
|
-
return new CancellablePromise((apply, reject) => {
|
|
47
|
-
handler = setInterval(() => {
|
|
48
|
-
apply();
|
|
49
|
-
}, timeout);
|
|
50
|
-
}, () => {
|
|
51
|
-
if (handler) {
|
|
52
|
-
clearInterval(handler);
|
|
53
|
-
handler = null;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.interval = interval;
|
|
58
|
-
/**
|
|
59
|
-
* a small (probably not 100% correct, although I tried to be correct as possible) Promise implementation
|
|
60
|
-
* for systems which do not have a promise implemented
|
|
61
|
-
* Note, although an internal state is kept, this is sideffect free since
|
|
62
|
-
* is value is a function to operate on, hence no real state is kept internally, except for the then
|
|
63
|
-
* and catch calling order
|
|
64
|
-
*/
|
|
65
|
-
class Promise {
|
|
66
|
-
constructor(executor) {
|
|
67
|
-
this.status = PromiseStatus.PENDING;
|
|
68
|
-
this.allFuncs = [];
|
|
69
|
-
//super(executor);
|
|
70
|
-
this.value = executor;
|
|
71
|
-
this.value((data) => this.resolve(data), (data) => this.reject(data));
|
|
72
|
-
}
|
|
73
|
-
static all(...promises) {
|
|
74
|
-
let promiseCnt = 0;
|
|
75
|
-
let myapply;
|
|
76
|
-
let myPromise = new Promise((apply, reject) => {
|
|
77
|
-
myapply = apply;
|
|
78
|
-
});
|
|
79
|
-
let executor = () => {
|
|
80
|
-
promiseCnt++;
|
|
81
|
-
if (promises.length == promiseCnt) {
|
|
82
|
-
myapply();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
executor.__last__ = true;
|
|
86
|
-
for (let cnt = 0; cnt < promises.length; cnt++) {
|
|
87
|
-
promises[cnt].finally(executor);
|
|
88
|
-
}
|
|
89
|
-
return myPromise;
|
|
90
|
-
}
|
|
91
|
-
static race(...promises) {
|
|
92
|
-
let promiseCnt = 0;
|
|
93
|
-
let myapply;
|
|
94
|
-
let myreject;
|
|
95
|
-
let myPromise = new Promise((apply, reject) => {
|
|
96
|
-
myapply = apply;
|
|
97
|
-
myreject = reject;
|
|
98
|
-
});
|
|
99
|
-
let thenexecutor = () => {
|
|
100
|
-
if (!!myapply) {
|
|
101
|
-
myapply();
|
|
102
|
-
}
|
|
103
|
-
myapply = null;
|
|
104
|
-
myreject = null;
|
|
105
|
-
return null;
|
|
106
|
-
};
|
|
107
|
-
thenexecutor.__last__ = true;
|
|
108
|
-
let catchexeutor = () => {
|
|
109
|
-
if (!!myreject) {
|
|
110
|
-
myreject();
|
|
111
|
-
}
|
|
112
|
-
myreject = null;
|
|
113
|
-
myapply = null;
|
|
114
|
-
return null;
|
|
115
|
-
};
|
|
116
|
-
catchexeutor.__last__ = true;
|
|
117
|
-
for (let cnt = 0; cnt < promises.length; cnt++) {
|
|
118
|
-
promises[cnt].then(thenexecutor);
|
|
119
|
-
promises[cnt].catch(catchexeutor);
|
|
120
|
-
}
|
|
121
|
-
return myPromise;
|
|
122
|
-
}
|
|
123
|
-
static reject(reason) {
|
|
124
|
-
let retVal = new Promise((resolve, reject) => {
|
|
125
|
-
//not really doable without a hack
|
|
126
|
-
if (reason instanceof Promise) {
|
|
127
|
-
reason.then((val) => {
|
|
128
|
-
reject(val);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
reject(reason);
|
|
134
|
-
}, 1);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
return retVal;
|
|
138
|
-
}
|
|
139
|
-
static resolve(reason) {
|
|
140
|
-
let retVal = new Promise((resolve, reject) => {
|
|
141
|
-
//not really doable without a hack
|
|
142
|
-
if (reason instanceof Promise) {
|
|
143
|
-
reason.then((val) => resolve(val));
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
setTimeout(() => {
|
|
147
|
-
resolve(reason);
|
|
148
|
-
}, 1);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return retVal;
|
|
152
|
-
}
|
|
153
|
-
then(executorFunc, catchfunc) {
|
|
154
|
-
this.allFuncs.push({ "then": executorFunc });
|
|
155
|
-
if (catchfunc) {
|
|
156
|
-
this.allFuncs.push({ "catch": catchfunc });
|
|
157
|
-
}
|
|
158
|
-
this.spliceLastFuncs();
|
|
159
|
-
return this;
|
|
160
|
-
}
|
|
161
|
-
catch(executorFunc) {
|
|
162
|
-
this.allFuncs.push({ "catch": executorFunc });
|
|
163
|
-
this.spliceLastFuncs();
|
|
164
|
-
return this;
|
|
165
|
-
}
|
|
166
|
-
finally(executorFunc) {
|
|
167
|
-
if (this.__reason__) {
|
|
168
|
-
this.__reason__.finally(executorFunc);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
this.allFuncs.push({ "finally": executorFunc });
|
|
172
|
-
this.spliceLastFuncs();
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
resolve(val) {
|
|
176
|
-
while (this.allFuncs.length) {
|
|
177
|
-
if (!this.allFuncs[0].then) {
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
let fn = this.allFuncs.shift();
|
|
181
|
-
let funcResult = Monad_1.Optional.fromNullable(fn.then(val));
|
|
182
|
-
if (funcResult.isPresent()) {
|
|
183
|
-
funcResult = funcResult.flatMap();
|
|
184
|
-
val = funcResult.value;
|
|
185
|
-
if (val instanceof Promise) {
|
|
186
|
-
//let func = (newVal: any) => {this.resolve(newVal)};
|
|
187
|
-
//func.__last__ = true;
|
|
188
|
-
//val.then(func);
|
|
189
|
-
this.transferIntoNewPromise(val);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
this.appyFinally();
|
|
198
|
-
this.status = PromiseStatus.FULLFILLED;
|
|
199
|
-
}
|
|
200
|
-
reject(val) {
|
|
201
|
-
while (this.allFuncs.length) {
|
|
202
|
-
if (this.allFuncs[0].finally) {
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
let fn = this.allFuncs.shift();
|
|
206
|
-
if (fn.catch) {
|
|
207
|
-
let funcResult = Monad_1.Optional.fromNullable(fn.catch(val));
|
|
208
|
-
if (funcResult.isPresent()) {
|
|
209
|
-
funcResult = funcResult.flatMap();
|
|
210
|
-
val = funcResult.value;
|
|
211
|
-
if (val instanceof Promise) {
|
|
212
|
-
//val.then((newVal: any) => {this.resolve(newVal)});
|
|
213
|
-
this.transferIntoNewPromise(val);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
this.status = PromiseStatus.REJECTED;
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
this.status = PromiseStatus.REJECTED;
|
|
225
|
-
this.appyFinally();
|
|
226
|
-
}
|
|
227
|
-
appyFinally() {
|
|
228
|
-
while (this.allFuncs.length) {
|
|
229
|
-
let fn = this.allFuncs.shift();
|
|
230
|
-
if (fn.finally) {
|
|
231
|
-
fn.finally();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
spliceLastFuncs() {
|
|
236
|
-
let lastFuncs = [];
|
|
237
|
-
let rest = [];
|
|
238
|
-
for (let cnt = 0; cnt < this.allFuncs.length; cnt++) {
|
|
239
|
-
for (let key in this.allFuncs[cnt]) {
|
|
240
|
-
if (this.allFuncs[cnt][key].__last__) {
|
|
241
|
-
lastFuncs.push(this.allFuncs[cnt]);
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
rest.push(this.allFuncs[cnt]);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
this.allFuncs = rest.concat(lastFuncs);
|
|
249
|
-
}
|
|
250
|
-
transferIntoNewPromise(val) {
|
|
251
|
-
for (let cnt = 0; cnt < this.allFuncs.length; cnt++) {
|
|
252
|
-
for (let key in this.allFuncs[cnt]) {
|
|
253
|
-
val[key](this.allFuncs[cnt][key]);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
exports.Promise = Promise;
|
|
259
|
-
/**
|
|
260
|
-
* a cancellable promise
|
|
261
|
-
* a Promise with a cancel function, which can be cancellend any time
|
|
262
|
-
* this is useful for promises which use cancellable asynchronous operations
|
|
263
|
-
* note, even in a cancel state, the finally of the promise is executed, however
|
|
264
|
-
* subsequent thens are not anymore.
|
|
265
|
-
* The current then however is fished or a catch is called depending on how the outer
|
|
266
|
-
* operation reacts to a cancel order.
|
|
267
|
-
*/
|
|
268
|
-
class CancellablePromise extends Promise {
|
|
269
|
-
/**
|
|
270
|
-
* @param executor asynchronous callback operation which triggers the callback
|
|
271
|
-
* @param cancellator cancel operation, separate from the trigger operation
|
|
272
|
-
*/
|
|
273
|
-
constructor(executor, cancellator) {
|
|
274
|
-
super(executor);
|
|
275
|
-
this.cancellator = () => {
|
|
276
|
-
};
|
|
277
|
-
this.cancellator = cancellator;
|
|
278
|
-
}
|
|
279
|
-
cancel() {
|
|
280
|
-
this.status = PromiseStatus.REJECTED;
|
|
281
|
-
this.appyFinally();
|
|
282
|
-
//lets terminate it once and for all, the finally has been applied
|
|
283
|
-
this.allFuncs = [];
|
|
284
|
-
}
|
|
285
|
-
then(executorFunc, catchfunc) {
|
|
286
|
-
return super.then(executorFunc, catchfunc);
|
|
287
|
-
}
|
|
288
|
-
catch(executorFunc) {
|
|
289
|
-
return super.catch(executorFunc);
|
|
290
|
-
}
|
|
291
|
-
finally(executorFunc) {
|
|
292
|
-
return super.finally(executorFunc);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
exports.CancellablePromise = CancellablePromise;
|
|
296
|
-
//# sourceMappingURL=Promise.js.map
|
package/target/Promise.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Promise.js","sourceRoot":"","sources":["../src/main/typescript/Promise.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,mCAAiC;AAEjC,IAAY,aAEX;AAFD,WAAY,aAAa;IACrB,uDAAO,CAAA;IAAE,6DAAU,CAAA;IAAE,yDAAQ,CAAA;AACjC,CAAC,EAFW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAExB;AAWD;;GAEG;AACH,SAAgB,OAAO,CAAC,OAAe;IACnC,IAAI,OAAO,GAAQ,IAAI,CAAC;IACxB,OAAO,IAAI,kBAAkB,CAAC,CAAC,KAAe,EAAE,MAAgB,EAAE,EAAE;QAChE,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,C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AG,GAAG,EAAE;QAC3B,CAAC,CAAC;QAvBE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAED,MAAM;QACF,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC;QACrC,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,kEAAkE;QAClE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,YAAgC,EAAE,SAA8B;QACjE,OAA2B,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,YAAiC;QACnC,OAA2B,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,YAAwB;QAC5B,OAA2B,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;CAIJ;AAhCD,gDAgCC"}
|
package/target/PromiseShim.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
-
* or more contributor license agreements. See the NOTICE file
|
|
5
|
-
* distributed with this work for additional information
|
|
6
|
-
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
-
* to you under the Apache License, Version 2.0 (the
|
|
8
|
-
* "License"); you may not use this file except in compliance
|
|
9
|
-
* with the License. You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing,
|
|
14
|
-
* software distributed under the License is distributed on an
|
|
15
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
* KIND, either express or implied. See the License for the
|
|
17
|
-
* specific language governing permissions and limitations
|
|
18
|
-
* under the License.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Promise shim which uses our Promise implementation in the window context
|
|
22
|
-
*/
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
const Promise_1 = require("./Promise");
|
|
25
|
-
const Global_1 = require("./Global");
|
|
26
|
-
if (!Promise) {
|
|
27
|
-
//we register promise in the global context
|
|
28
|
-
Global_1._global$["Promise"] = Promise_1.Promise;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=PromiseShim.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PromiseShim.js","sourceRoot":"","sources":["../src/main/typescript/PromiseShim.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH;;GAEG;;AAEH,uCAA8C;AAC9C,qCAAkC;AAGlC,IAAG,CAAC,OAAO,EAAE;IACT,2CAA2C;IAC3C,iBAAQ,CAAC,SAAS,CAAC,GAAG,iBAAQ,CAAC;CAClC"}
|