d5-api-initializer 1.0.2 → 1.0.3
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/package.json
CHANGED
|
@@ -33,6 +33,7 @@ __export(lib_index_exports, {
|
|
|
33
33
|
ApiObjectCollectionIterator: () => ApiObjectCollectionIterator,
|
|
34
34
|
ApiRequest: () => ApiRequest,
|
|
35
35
|
ApiResponse: () => ApiResponse,
|
|
36
|
+
ApplicationInitializer: () => ApplicationInitializer,
|
|
36
37
|
EngineInitializer: () => EngineInitializer,
|
|
37
38
|
LanguageCode: () => LanguageCode,
|
|
38
39
|
UserMessages: () => UserMessages_default,
|
|
@@ -835,6 +836,39 @@ var EngineInitializer = class {
|
|
|
835
836
|
}
|
|
836
837
|
};
|
|
837
838
|
|
|
839
|
+
// src/classes/ApplicationInitializer.ts
|
|
840
|
+
var ApplicationInitializer = class {
|
|
841
|
+
constructor(operations) {
|
|
842
|
+
__publicField(this, "jSWapiApplication");
|
|
843
|
+
__publicField(this, "_operations");
|
|
844
|
+
const throwError = (msg) => {
|
|
845
|
+
throw new Error(msg);
|
|
846
|
+
};
|
|
847
|
+
if (!operations)
|
|
848
|
+
throwError('Property "operations" in the settings is required');
|
|
849
|
+
this._operations = operations;
|
|
850
|
+
this.internalCreate();
|
|
851
|
+
}
|
|
852
|
+
internalCreate() {
|
|
853
|
+
jsWapi.setJSWapiObject((jSWapiApplication) => {
|
|
854
|
+
this.jSWapiApplication = jSWapiApplication;
|
|
855
|
+
for (const operationName in this._operations) {
|
|
856
|
+
this.putOperation(operationName);
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
putOperation(operationName) {
|
|
861
|
+
this.jSWapiApplication.putJSWapiOper(operationName, (jsWapiRequest, jsWapiResponse) => {
|
|
862
|
+
const request = new ApiRequest(jsWapiRequest, this.jSWapiApplication.getName());
|
|
863
|
+
return this._operations[operationName](
|
|
864
|
+
new ApiCore({ http: this.jSWapiApplication, request }),
|
|
865
|
+
request,
|
|
866
|
+
new ApiResponse(jsWapiResponse, this.jSWapiApplication.getName())
|
|
867
|
+
);
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
|
|
838
872
|
// src/classes/ApiJoinInvoker.ts
|
|
839
873
|
var ApiJoinInvoker = class {
|
|
840
874
|
constructor(jsWapiJoinInvoker) {
|
|
@@ -856,6 +890,7 @@ var lib_index_default = ApiObjectInitializer;
|
|
|
856
890
|
ApiObjectCollectionIterator,
|
|
857
891
|
ApiRequest,
|
|
858
892
|
ApiResponse,
|
|
893
|
+
ApplicationInitializer,
|
|
859
894
|
EngineInitializer,
|
|
860
895
|
LanguageCode,
|
|
861
896
|
UserMessages
|
|
@@ -424,6 +424,14 @@ declare class EngineInitializer<MetaParams = Record<string, any>> {
|
|
|
424
424
|
}): void;
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
declare class ApplicationInitializer<MetaParams = undefined> {
|
|
428
|
+
private jSWapiApplication;
|
|
429
|
+
protected _operations: IApiOperations<MetaParams>;
|
|
430
|
+
constructor(operations: IApiOperations<MetaParams>);
|
|
431
|
+
private internalCreate;
|
|
432
|
+
private putOperation;
|
|
433
|
+
}
|
|
434
|
+
|
|
427
435
|
declare class ApiJoinInvoker {
|
|
428
436
|
readonly _jsWapiJoinInvoker: any;
|
|
429
437
|
constructor(jsWapiJoinInvoker: any);
|
|
@@ -438,4 +446,4 @@ declare class UserMessages {
|
|
|
438
446
|
}
|
|
439
447
|
declare const _default: UserMessages;
|
|
440
448
|
|
|
441
|
-
export { ApiCore, ApiHttpRequest, ApiHttpResponse, ApiInvoker, ApiJoinInvoker, ApiObjectCollectionIterator, ApiRequest, ApiResponse, EngineInitializer, IApiOperations, IFilter, IFilterValue, IFiltersCollection, IHttpCallback, IMappedCollection, LanguageCode, _default as UserMessages, ApiObjectInitializer as default };
|
|
449
|
+
export { ApiCore, ApiHttpRequest, ApiHttpResponse, ApiInvoker, ApiJoinInvoker, ApiObjectCollectionIterator, ApiRequest, ApiResponse, ApplicationInitializer, EngineInitializer, IApiOperations, IFilter, IFilterValue, IFiltersCollection, IHttpCallback, IMappedCollection, LanguageCode, _default as UserMessages, ApiObjectInitializer as default };
|
|
@@ -800,6 +800,39 @@ var EngineInitializer = class {
|
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
+
// src/classes/ApplicationInitializer.ts
|
|
804
|
+
var ApplicationInitializer = class {
|
|
805
|
+
constructor(operations) {
|
|
806
|
+
__publicField(this, "jSWapiApplication");
|
|
807
|
+
__publicField(this, "_operations");
|
|
808
|
+
const throwError = (msg) => {
|
|
809
|
+
throw new Error(msg);
|
|
810
|
+
};
|
|
811
|
+
if (!operations)
|
|
812
|
+
throwError('Property "operations" in the settings is required');
|
|
813
|
+
this._operations = operations;
|
|
814
|
+
this.internalCreate();
|
|
815
|
+
}
|
|
816
|
+
internalCreate() {
|
|
817
|
+
jsWapi.setJSWapiObject((jSWapiApplication) => {
|
|
818
|
+
this.jSWapiApplication = jSWapiApplication;
|
|
819
|
+
for (const operationName in this._operations) {
|
|
820
|
+
this.putOperation(operationName);
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
putOperation(operationName) {
|
|
825
|
+
this.jSWapiApplication.putJSWapiOper(operationName, (jsWapiRequest, jsWapiResponse) => {
|
|
826
|
+
const request = new ApiRequest(jsWapiRequest, this.jSWapiApplication.getName());
|
|
827
|
+
return this._operations[operationName](
|
|
828
|
+
new ApiCore({ http: this.jSWapiApplication, request }),
|
|
829
|
+
request,
|
|
830
|
+
new ApiResponse(jsWapiResponse, this.jSWapiApplication.getName())
|
|
831
|
+
);
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
|
|
803
836
|
// src/classes/ApiJoinInvoker.ts
|
|
804
837
|
var ApiJoinInvoker = class {
|
|
805
838
|
constructor(jsWapiJoinInvoker) {
|
|
@@ -820,6 +853,7 @@ export {
|
|
|
820
853
|
ApiObjectCollectionIterator,
|
|
821
854
|
ApiRequest,
|
|
822
855
|
ApiResponse,
|
|
856
|
+
ApplicationInitializer,
|
|
823
857
|
EngineInitializer,
|
|
824
858
|
LanguageCode,
|
|
825
859
|
UserMessages_default as UserMessages,
|
|
@@ -800,6 +800,39 @@ var EngineInitializer = class {
|
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
+
// src/classes/ApplicationInitializer.ts
|
|
804
|
+
var ApplicationInitializer = class {
|
|
805
|
+
constructor(operations) {
|
|
806
|
+
__publicField(this, "jSWapiApplication");
|
|
807
|
+
__publicField(this, "_operations");
|
|
808
|
+
const throwError = (msg) => {
|
|
809
|
+
throw new Error(msg);
|
|
810
|
+
};
|
|
811
|
+
if (!operations)
|
|
812
|
+
throwError('Property "operations" in the settings is required');
|
|
813
|
+
this._operations = operations;
|
|
814
|
+
this.internalCreate();
|
|
815
|
+
}
|
|
816
|
+
internalCreate() {
|
|
817
|
+
jsWapi.setJSWapiObject((jSWapiApplication) => {
|
|
818
|
+
this.jSWapiApplication = jSWapiApplication;
|
|
819
|
+
for (const operationName in this._operations) {
|
|
820
|
+
this.putOperation(operationName);
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
putOperation(operationName) {
|
|
825
|
+
this.jSWapiApplication.putJSWapiOper(operationName, (jsWapiRequest, jsWapiResponse) => {
|
|
826
|
+
const request = new ApiRequest(jsWapiRequest, this.jSWapiApplication.getName());
|
|
827
|
+
return this._operations[operationName](
|
|
828
|
+
new ApiCore({ http: this.jSWapiApplication, request }),
|
|
829
|
+
request,
|
|
830
|
+
new ApiResponse(jsWapiResponse, this.jSWapiApplication.getName())
|
|
831
|
+
);
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
|
|
803
836
|
// src/classes/ApiJoinInvoker.ts
|
|
804
837
|
var ApiJoinInvoker = class {
|
|
805
838
|
constructor(jsWapiJoinInvoker) {
|
|
@@ -820,6 +853,7 @@ export {
|
|
|
820
853
|
ApiObjectCollectionIterator,
|
|
821
854
|
ApiRequest,
|
|
822
855
|
ApiResponse,
|
|
856
|
+
ApplicationInitializer,
|
|
823
857
|
EngineInitializer,
|
|
824
858
|
LanguageCode,
|
|
825
859
|
UserMessages_default as UserMessages,
|