@freelog/tools-lib 0.1.89 → 0.1.93

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.
Files changed (36) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +103 -103
  3. package/dist/service-API/activities.d.ts +12 -0
  4. package/dist/service-API/informalNodes.d.ts +15 -45
  5. package/dist/service-API/policies.d.ts +2 -6
  6. package/dist/tools-lib.cjs.development.js +536 -926
  7. package/dist/tools-lib.cjs.development.js.map +1 -1
  8. package/dist/tools-lib.cjs.production.min.js +1 -1
  9. package/dist/tools-lib.cjs.production.min.js.map +1 -1
  10. package/dist/tools-lib.esm.js +536 -926
  11. package/dist/tools-lib.esm.js.map +1 -1
  12. package/dist/utils/axios.d.ts +1 -4
  13. package/package.json +1 -1
  14. package/src/index.ts +7 -7
  15. package/src/service-API/activities.ts +32 -0
  16. package/src/service-API/captcha.ts +30 -30
  17. package/src/service-API/collections.ts +81 -81
  18. package/src/service-API/contracts.ts +84 -84
  19. package/src/service-API/events.ts +18 -18
  20. package/src/service-API/index.ts +29 -29
  21. package/src/service-API/informalNodes.ts +238 -238
  22. package/src/service-API/nodes.ts +65 -65
  23. package/src/service-API/policies.ts +39 -39
  24. package/src/service-API/presentables.ts +282 -282
  25. package/src/service-API/resources.ts +496 -496
  26. package/src/service-API/storages.ts +345 -345
  27. package/src/service-API/tools/index.ts +10 -10
  28. package/src/service-API/transactions.ts +109 -109
  29. package/src/service-API/user.ts +188 -188
  30. package/src/utils/axios.ts +8 -3
  31. package/src/utils/format.ts +89 -89
  32. package/src/utils/index.ts +18 -18
  33. package/src/utils/linkTo.ts +332 -332
  34. package/src/utils/predefined.ts +37 -37
  35. package/src/utils/regexp.ts +52 -52
  36. package/src/utils/tools.ts +72 -72
@@ -12,832 +12,422 @@ var NProgress = _interopDefault(require('nprogress'));
12
12
  require('nprogress/nprogress.css');
13
13
  var CryptoJS = require('crypto-js');
14
14
 
15
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
- try {
17
- var info = gen[key](arg);
18
- var value = info.value;
19
- } catch (error) {
20
- reject(error);
21
- return;
22
- }
23
-
24
- if (info.done) {
25
- resolve(value);
26
- } else {
27
- Promise.resolve(value).then(_next, _throw);
28
- }
29
- }
30
-
31
- function _asyncToGenerator(fn) {
32
- return function () {
33
- var self = this,
34
- args = arguments;
35
- return new Promise(function (resolve, reject) {
36
- var gen = fn.apply(self, args);
37
-
38
- function _next(value) {
39
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
40
- }
15
+ function _regeneratorRuntime() {
16
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
41
17
 
42
- function _throw(err) {
43
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44
- }
45
-
46
- _next(undefined);
47
- });
18
+ _regeneratorRuntime = function () {
19
+ return exports;
48
20
  };
49
- }
50
21
 
51
- function _extends() {
52
- _extends = Object.assign || function (target) {
53
- for (var i = 1; i < arguments.length; i++) {
54
- var source = arguments[i];
55
-
56
- for (var key in source) {
57
- if (Object.prototype.hasOwnProperty.call(source, key)) {
58
- target[key] = source[key];
59
- }
60
- }
61
- }
62
-
63
- return target;
64
- };
65
-
66
- return _extends.apply(this, arguments);
67
- }
68
-
69
- function _objectDestructuringEmpty(obj) {
70
- if (obj == null) throw new TypeError("Cannot destructure undefined");
71
- }
72
-
73
- function _objectWithoutPropertiesLoose(source, excluded) {
74
- if (source == null) return {};
75
- var target = {};
76
- var sourceKeys = Object.keys(source);
77
- var key, i;
78
-
79
- for (i = 0; i < sourceKeys.length; i++) {
80
- key = sourceKeys[i];
81
- if (excluded.indexOf(key) >= 0) continue;
82
- target[key] = source[key];
83
- }
84
-
85
- return target;
86
- }
87
-
88
- function createCommonjsModule(fn, module) {
89
- return module = { exports: {} }, fn(module, module.exports), module.exports;
90
- }
91
-
92
- var runtime_1 = createCommonjsModule(function (module) {
93
- /**
94
- * Copyright (c) 2014-present, Facebook, Inc.
95
- *
96
- * This source code is licensed under the MIT license found in the
97
- * LICENSE file in the root directory of this source tree.
98
- */
99
-
100
- var runtime = (function (exports) {
101
-
102
- var Op = Object.prototype;
103
- var hasOwn = Op.hasOwnProperty;
104
- var undefined$1; // More compressible than void 0.
105
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
106
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
107
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
108
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
22
+ var exports = {},
23
+ Op = Object.prototype,
24
+ hasOwn = Op.hasOwnProperty,
25
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
26
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
27
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
28
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
109
29
 
110
30
  function define(obj, key, value) {
111
- Object.defineProperty(obj, key, {
31
+ return Object.defineProperty(obj, key, {
112
32
  value: value,
113
- enumerable: true,
114
- configurable: true,
115
- writable: true
116
- });
117
- return obj[key];
33
+ enumerable: !0,
34
+ configurable: !0,
35
+ writable: !0
36
+ }), obj[key];
118
37
  }
38
+
119
39
  try {
120
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
121
40
  define({}, "");
122
41
  } catch (err) {
123
- define = function(obj, key, value) {
42
+ define = function (obj, key, value) {
124
43
  return obj[key] = value;
125
44
  };
126
45
  }
127
46
 
128
47
  function wrap(innerFn, outerFn, self, tryLocsList) {
129
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
130
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
131
- var generator = Object.create(protoGenerator.prototype);
132
- var context = new Context(tryLocsList || []);
48
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
49
+ generator = Object.create(protoGenerator.prototype),
50
+ context = new Context(tryLocsList || []);
51
+ return generator._invoke = function (innerFn, self, context) {
52
+ var state = "suspendedStart";
53
+ return function (method, arg) {
54
+ if ("executing" === state) throw new Error("Generator is already running");
55
+
56
+ if ("completed" === state) {
57
+ if ("throw" === method) throw arg;
58
+ return doneResult();
59
+ }
60
+
61
+ for (context.method = method, context.arg = arg;;) {
62
+ var delegate = context.delegate;
63
+
64
+ if (delegate) {
65
+ var delegateResult = maybeInvokeDelegate(delegate, context);
66
+
67
+ if (delegateResult) {
68
+ if (delegateResult === ContinueSentinel) continue;
69
+ return delegateResult;
70
+ }
71
+ }
133
72
 
134
- // The ._invoke method unifies the implementations of the .next,
135
- // .throw, and .return methods.
136
- generator._invoke = makeInvokeMethod(innerFn, self, context);
73
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
74
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
75
+ context.dispatchException(context.arg);
76
+ } else "return" === context.method && context.abrupt("return", context.arg);
77
+ state = "executing";
78
+ var record = tryCatch(innerFn, self, context);
79
+
80
+ if ("normal" === record.type) {
81
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
82
+ return {
83
+ value: record.arg,
84
+ done: context.done
85
+ };
86
+ }
137
87
 
138
- return generator;
88
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
89
+ }
90
+ };
91
+ }(innerFn, self, context), generator;
139
92
  }
140
- exports.wrap = wrap;
141
93
 
142
- // Try/catch helper to minimize deoptimizations. Returns a completion
143
- // record like context.tryEntries[i].completion. This interface could
144
- // have been (and was previously) designed to take a closure to be
145
- // invoked without arguments, but in all the cases we care about we
146
- // already have an existing method we want to call, so there's no need
147
- // to create a new function object. We can even get away with assuming
148
- // the method takes exactly one argument, since that happens to be true
149
- // in every case, so we don't have to touch the arguments object. The
150
- // only additional allocation required is the completion record, which
151
- // has a stable shape and so hopefully should be cheap to allocate.
152
94
  function tryCatch(fn, obj, arg) {
153
95
  try {
154
- return { type: "normal", arg: fn.call(obj, arg) };
96
+ return {
97
+ type: "normal",
98
+ arg: fn.call(obj, arg)
99
+ };
155
100
  } catch (err) {
156
- return { type: "throw", arg: err };
101
+ return {
102
+ type: "throw",
103
+ arg: err
104
+ };
157
105
  }
158
106
  }
159
107
 
160
- var GenStateSuspendedStart = "suspendedStart";
161
- var GenStateSuspendedYield = "suspendedYield";
162
- var GenStateExecuting = "executing";
163
- var GenStateCompleted = "completed";
164
-
165
- // Returning this object from the innerFn has the same effect as
166
- // breaking out of the dispatch switch statement.
108
+ exports.wrap = wrap;
167
109
  var ContinueSentinel = {};
168
110
 
169
- // Dummy constructor functions that we use as the .constructor and
170
- // .constructor.prototype properties for functions that return Generator
171
- // objects. For full spec compliance, you may wish to configure your
172
- // minifier not to mangle the names of these two functions.
173
111
  function Generator() {}
112
+
174
113
  function GeneratorFunction() {}
114
+
175
115
  function GeneratorFunctionPrototype() {}
176
116
 
177
- // This is a polyfill for %IteratorPrototype% for environments that
178
- // don't natively support it.
179
117
  var IteratorPrototype = {};
180
- IteratorPrototype[iteratorSymbol] = function () {
118
+ define(IteratorPrototype, iteratorSymbol, function () {
181
119
  return this;
182
- };
183
-
184
- var getProto = Object.getPrototypeOf;
185
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
186
- if (NativeIteratorPrototype &&
187
- NativeIteratorPrototype !== Op &&
188
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
189
- // This environment has a native %IteratorPrototype%; use it instead
190
- // of the polyfill.
191
- IteratorPrototype = NativeIteratorPrototype;
192
- }
120
+ });
121
+ var getProto = Object.getPrototypeOf,
122
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
123
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
124
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
193
125
 
194
- var Gp = GeneratorFunctionPrototype.prototype =
195
- Generator.prototype = Object.create(IteratorPrototype);
196
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
197
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
198
- GeneratorFunction.displayName = define(
199
- GeneratorFunctionPrototype,
200
- toStringTagSymbol,
201
- "GeneratorFunction"
202
- );
203
-
204
- // Helper for defining the .next, .throw, and .return methods of the
205
- // Iterator interface in terms of a single ._invoke method.
206
126
  function defineIteratorMethods(prototype) {
207
- ["next", "throw", "return"].forEach(function(method) {
208
- define(prototype, method, function(arg) {
127
+ ["next", "throw", "return"].forEach(function (method) {
128
+ define(prototype, method, function (arg) {
209
129
  return this._invoke(method, arg);
210
130
  });
211
131
  });
212
132
  }
213
133
 
214
- exports.isGeneratorFunction = function(genFun) {
215
- var ctor = typeof genFun === "function" && genFun.constructor;
216
- return ctor
217
- ? ctor === GeneratorFunction ||
218
- // For the native GeneratorFunction constructor, the best we can
219
- // do is to check its .name property.
220
- (ctor.displayName || ctor.name) === "GeneratorFunction"
221
- : false;
222
- };
223
-
224
- exports.mark = function(genFun) {
225
- if (Object.setPrototypeOf) {
226
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
227
- } else {
228
- genFun.__proto__ = GeneratorFunctionPrototype;
229
- define(genFun, toStringTagSymbol, "GeneratorFunction");
230
- }
231
- genFun.prototype = Object.create(Gp);
232
- return genFun;
233
- };
234
-
235
- // Within the body of any async function, `await x` is transformed to
236
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
237
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
238
- // meant to be awaited.
239
- exports.awrap = function(arg) {
240
- return { __await: arg };
241
- };
242
-
243
134
  function AsyncIterator(generator, PromiseImpl) {
244
135
  function invoke(method, arg, resolve, reject) {
245
136
  var record = tryCatch(generator[method], generator, arg);
246
- if (record.type === "throw") {
247
- reject(record.arg);
248
- } else {
249
- var result = record.arg;
250
- var value = result.value;
251
- if (value &&
252
- typeof value === "object" &&
253
- hasOwn.call(value, "__await")) {
254
- return PromiseImpl.resolve(value.__await).then(function(value) {
255
- invoke("next", value, resolve, reject);
256
- }, function(err) {
257
- invoke("throw", err, resolve, reject);
258
- });
259
- }
260
137
 
261
- return PromiseImpl.resolve(value).then(function(unwrapped) {
262
- // When a yielded Promise is resolved, its final value becomes
263
- // the .value of the Promise<{value,done}> result for the
264
- // current iteration.
265
- result.value = unwrapped;
266
- resolve(result);
267
- }, function(error) {
268
- // If a rejected Promise was yielded, throw the rejection back
269
- // into the async generator function so it can be handled there.
138
+ if ("throw" !== record.type) {
139
+ var result = record.arg,
140
+ value = result.value;
141
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
142
+ invoke("next", value, resolve, reject);
143
+ }, function (err) {
144
+ invoke("throw", err, resolve, reject);
145
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
146
+ result.value = unwrapped, resolve(result);
147
+ }, function (error) {
270
148
  return invoke("throw", error, resolve, reject);
271
149
  });
272
150
  }
151
+
152
+ reject(record.arg);
273
153
  }
274
154
 
275
155
  var previousPromise;
276
156
 
277
- function enqueue(method, arg) {
157
+ this._invoke = function (method, arg) {
278
158
  function callInvokeWithMethodAndArg() {
279
- return new PromiseImpl(function(resolve, reject) {
159
+ return new PromiseImpl(function (resolve, reject) {
280
160
  invoke(method, arg, resolve, reject);
281
161
  });
282
162
  }
283
163
 
284
- return previousPromise =
285
- // If enqueue has been called before, then we want to wait until
286
- // all previous Promises have been resolved before calling invoke,
287
- // so that results are always delivered in the correct order. If
288
- // enqueue has not been called before, then it is important to
289
- // call invoke immediately, without waiting on a callback to fire,
290
- // so that the async generator function has the opportunity to do
291
- // any necessary setup in a predictable way. This predictability
292
- // is why the Promise constructor synchronously invokes its
293
- // executor callback, and why async functions synchronously
294
- // execute code before the first await. Since we implement simple
295
- // async functions in terms of async generators, it is especially
296
- // important to get this right, even though it requires care.
297
- previousPromise ? previousPromise.then(
298
- callInvokeWithMethodAndArg,
299
- // Avoid propagating failures to Promises returned by later
300
- // invocations of the iterator.
301
- callInvokeWithMethodAndArg
302
- ) : callInvokeWithMethodAndArg();
303
- }
304
-
305
- // Define the unified helper method that is used to implement .next,
306
- // .throw, and .return (see defineIteratorMethods).
307
- this._invoke = enqueue;
308
- }
309
-
310
- defineIteratorMethods(AsyncIterator.prototype);
311
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
312
- return this;
313
- };
314
- exports.AsyncIterator = AsyncIterator;
315
-
316
- // Note that simple async functions are implemented on top of
317
- // AsyncIterator objects; they just return a Promise for the value of
318
- // the final result produced by the iterator.
319
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
320
- if (PromiseImpl === void 0) PromiseImpl = Promise;
321
-
322
- var iter = new AsyncIterator(
323
- wrap(innerFn, outerFn, self, tryLocsList),
324
- PromiseImpl
325
- );
326
-
327
- return exports.isGeneratorFunction(outerFn)
328
- ? iter // If outerFn is a generator, return the full iterator.
329
- : iter.next().then(function(result) {
330
- return result.done ? result.value : iter.next();
331
- });
332
- };
333
-
334
- function makeInvokeMethod(innerFn, self, context) {
335
- var state = GenStateSuspendedStart;
336
-
337
- return function invoke(method, arg) {
338
- if (state === GenStateExecuting) {
339
- throw new Error("Generator is already running");
340
- }
341
-
342
- if (state === GenStateCompleted) {
343
- if (method === "throw") {
344
- throw arg;
345
- }
346
-
347
- // Be forgiving, per 25.3.3.3.3 of the spec:
348
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
349
- return doneResult();
350
- }
351
-
352
- context.method = method;
353
- context.arg = arg;
354
-
355
- while (true) {
356
- var delegate = context.delegate;
357
- if (delegate) {
358
- var delegateResult = maybeInvokeDelegate(delegate, context);
359
- if (delegateResult) {
360
- if (delegateResult === ContinueSentinel) continue;
361
- return delegateResult;
362
- }
363
- }
364
-
365
- if (context.method === "next") {
366
- // Setting context._sent for legacy support of Babel's
367
- // function.sent implementation.
368
- context.sent = context._sent = context.arg;
369
-
370
- } else if (context.method === "throw") {
371
- if (state === GenStateSuspendedStart) {
372
- state = GenStateCompleted;
373
- throw context.arg;
374
- }
375
-
376
- context.dispatchException(context.arg);
377
-
378
- } else if (context.method === "return") {
379
- context.abrupt("return", context.arg);
380
- }
381
-
382
- state = GenStateExecuting;
383
-
384
- var record = tryCatch(innerFn, self, context);
385
- if (record.type === "normal") {
386
- // If an exception is thrown from innerFn, we leave state ===
387
- // GenStateExecuting and loop back for another invocation.
388
- state = context.done
389
- ? GenStateCompleted
390
- : GenStateSuspendedYield;
391
-
392
- if (record.arg === ContinueSentinel) {
393
- continue;
394
- }
395
-
396
- return {
397
- value: record.arg,
398
- done: context.done
399
- };
400
-
401
- } else if (record.type === "throw") {
402
- state = GenStateCompleted;
403
- // Dispatch the exception by looping back around to the
404
- // context.dispatchException(context.arg) call above.
405
- context.method = "throw";
406
- context.arg = record.arg;
407
- }
408
- }
164
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
409
165
  };
410
166
  }
411
167
 
412
- // Call delegate.iterator[context.method](context.arg) and handle the
413
- // result, either by returning a { value, done } result from the
414
- // delegate iterator, or by modifying context.method and context.arg,
415
- // setting context.delegate to null, and returning the ContinueSentinel.
416
168
  function maybeInvokeDelegate(delegate, context) {
417
169
  var method = delegate.iterator[context.method];
418
- if (method === undefined$1) {
419
- // A .throw or .return when the delegate iterator has no .throw
420
- // method always terminates the yield* loop.
421
- context.delegate = null;
422
-
423
- if (context.method === "throw") {
424
- // Note: ["return"] must be used for ES3 parsing compatibility.
425
- if (delegate.iterator["return"]) {
426
- // If the delegate iterator has a return method, give it a
427
- // chance to clean up.
428
- context.method = "return";
429
- context.arg = undefined$1;
430
- maybeInvokeDelegate(delegate, context);
431
-
432
- if (context.method === "throw") {
433
- // If maybeInvokeDelegate(context) changed context.method from
434
- // "return" to "throw", let that override the TypeError below.
435
- return ContinueSentinel;
436
- }
437
- }
438
170
 
439
- context.method = "throw";
440
- context.arg = new TypeError(
441
- "The iterator does not provide a 'throw' method");
171
+ if (undefined === method) {
172
+ if (context.delegate = null, "throw" === context.method) {
173
+ if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
174
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
442
175
  }
443
176
 
444
177
  return ContinueSentinel;
445
178
  }
446
179
 
447
180
  var record = tryCatch(method, delegate.iterator, context.arg);
448
-
449
- if (record.type === "throw") {
450
- context.method = "throw";
451
- context.arg = record.arg;
452
- context.delegate = null;
453
- return ContinueSentinel;
454
- }
455
-
181
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
456
182
  var info = record.arg;
457
-
458
- if (! info) {
459
- context.method = "throw";
460
- context.arg = new TypeError("iterator result is not an object");
461
- context.delegate = null;
462
- return ContinueSentinel;
463
- }
464
-
465
- if (info.done) {
466
- // Assign the result of the finished delegate to the temporary
467
- // variable specified by delegate.resultName (see delegateYield).
468
- context[delegate.resultName] = info.value;
469
-
470
- // Resume execution at the desired location (see delegateYield).
471
- context.next = delegate.nextLoc;
472
-
473
- // If context.method was "throw" but the delegate handled the
474
- // exception, let the outer generator proceed normally. If
475
- // context.method was "next", forget context.arg since it has been
476
- // "consumed" by the delegate iterator. If context.method was
477
- // "return", allow the original .return call to continue in the
478
- // outer generator.
479
- if (context.method !== "return") {
480
- context.method = "next";
481
- context.arg = undefined$1;
482
- }
483
-
484
- } else {
485
- // Re-yield the result returned by the delegate method.
486
- return info;
487
- }
488
-
489
- // The delegate iterator is finished, so forget it and continue with
490
- // the outer generator.
491
- context.delegate = null;
492
- return ContinueSentinel;
183
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
493
184
  }
494
185
 
495
- // Define Generator.prototype.{next,throw,return} in terms of the
496
- // unified ._invoke helper method.
497
- defineIteratorMethods(Gp);
498
-
499
- define(Gp, toStringTagSymbol, "Generator");
500
-
501
- // A Generator should always return itself as the iterator object when the
502
- // @@iterator function is called on it. Some browsers' implementations of the
503
- // iterator prototype chain incorrectly implement this, causing the Generator
504
- // object to not be returned from this call. This ensures that doesn't happen.
505
- // See https://github.com/facebook/regenerator/issues/274 for more details.
506
- Gp[iteratorSymbol] = function() {
507
- return this;
508
- };
509
-
510
- Gp.toString = function() {
511
- return "[object Generator]";
512
- };
513
-
514
186
  function pushTryEntry(locs) {
515
- var entry = { tryLoc: locs[0] };
516
-
517
- if (1 in locs) {
518
- entry.catchLoc = locs[1];
519
- }
520
-
521
- if (2 in locs) {
522
- entry.finallyLoc = locs[2];
523
- entry.afterLoc = locs[3];
524
- }
525
-
526
- this.tryEntries.push(entry);
187
+ var entry = {
188
+ tryLoc: locs[0]
189
+ };
190
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
527
191
  }
528
192
 
529
193
  function resetTryEntry(entry) {
530
194
  var record = entry.completion || {};
531
- record.type = "normal";
532
- delete record.arg;
533
- entry.completion = record;
195
+ record.type = "normal", delete record.arg, entry.completion = record;
534
196
  }
535
197
 
536
198
  function Context(tryLocsList) {
537
- // The root entry object (effectively a try statement without a catch
538
- // or a finally block) gives us a place to store values thrown from
539
- // locations where there is no enclosing try statement.
540
- this.tryEntries = [{ tryLoc: "root" }];
541
- tryLocsList.forEach(pushTryEntry, this);
542
- this.reset(true);
199
+ this.tryEntries = [{
200
+ tryLoc: "root"
201
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
543
202
  }
544
203
 
545
- exports.keys = function(object) {
546
- var keys = [];
547
- for (var key in object) {
548
- keys.push(key);
549
- }
550
- keys.reverse();
551
-
552
- // Rather than returning an object with a next method, we keep
553
- // things simple and return the next function itself.
554
- return function next() {
555
- while (keys.length) {
556
- var key = keys.pop();
557
- if (key in object) {
558
- next.value = key;
559
- next.done = false;
560
- return next;
561
- }
562
- }
563
-
564
- // To avoid creating an additional object, we just hang the .value
565
- // and .done properties off the next function object itself. This
566
- // also ensures that the minifier will not anonymize the function.
567
- next.done = true;
568
- return next;
569
- };
570
- };
571
-
572
204
  function values(iterable) {
573
205
  if (iterable) {
574
206
  var iteratorMethod = iterable[iteratorSymbol];
575
- if (iteratorMethod) {
576
- return iteratorMethod.call(iterable);
577
- }
578
-
579
- if (typeof iterable.next === "function") {
580
- return iterable;
581
- }
207
+ if (iteratorMethod) return iteratorMethod.call(iterable);
208
+ if ("function" == typeof iterable.next) return iterable;
582
209
 
583
210
  if (!isNaN(iterable.length)) {
584
- var i = -1, next = function next() {
585
- while (++i < iterable.length) {
586
- if (hasOwn.call(iterable, i)) {
587
- next.value = iterable[i];
588
- next.done = false;
589
- return next;
590
- }
591
- }
592
-
593
- next.value = undefined$1;
594
- next.done = true;
211
+ var i = -1,
212
+ next = function next() {
213
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
595
214
 
596
- return next;
215
+ return next.value = undefined, next.done = !0, next;
597
216
  };
598
217
 
599
218
  return next.next = next;
600
219
  }
601
220
  }
602
221
 
603
- // Return an iterator with no values.
604
- return { next: doneResult };
222
+ return {
223
+ next: doneResult
224
+ };
605
225
  }
606
- exports.values = values;
607
226
 
608
227
  function doneResult() {
609
- return { value: undefined$1, done: true };
228
+ return {
229
+ value: undefined,
230
+ done: !0
231
+ };
610
232
  }
611
233
 
612
- Context.prototype = {
613
- constructor: Context,
614
-
615
- reset: function(skipTempReset) {
616
- this.prev = 0;
617
- this.next = 0;
618
- // Resetting context._sent for legacy support of Babel's
619
- // function.sent implementation.
620
- this.sent = this._sent = undefined$1;
621
- this.done = false;
622
- this.delegate = null;
623
-
624
- this.method = "next";
625
- this.arg = undefined$1;
626
-
627
- this.tryEntries.forEach(resetTryEntry);
628
-
629
- if (!skipTempReset) {
630
- for (var name in this) {
631
- // Not sure about the optimal order of these conditions:
632
- if (name.charAt(0) === "t" &&
633
- hasOwn.call(this, name) &&
634
- !isNaN(+name.slice(1))) {
635
- this[name] = undefined$1;
636
- }
637
- }
638
- }
639
- },
234
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
235
+ var ctor = "function" == typeof genFun && genFun.constructor;
236
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
237
+ }, exports.mark = function (genFun) {
238
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
239
+ }, exports.awrap = function (arg) {
240
+ return {
241
+ __await: arg
242
+ };
243
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
244
+ return this;
245
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
246
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
247
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
248
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
249
+ return result.done ? result.value : iter.next();
250
+ });
251
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
252
+ return this;
253
+ }), define(Gp, "toString", function () {
254
+ return "[object Generator]";
255
+ }), exports.keys = function (object) {
256
+ var keys = [];
640
257
 
641
- stop: function() {
642
- this.done = true;
258
+ for (var key in object) keys.push(key);
643
259
 
644
- var rootEntry = this.tryEntries[0];
645
- var rootRecord = rootEntry.completion;
646
- if (rootRecord.type === "throw") {
647
- throw rootRecord.arg;
260
+ return keys.reverse(), function next() {
261
+ for (; keys.length;) {
262
+ var key = keys.pop();
263
+ if (key in object) return next.value = key, next.done = !1, next;
648
264
  }
649
265
 
266
+ return next.done = !0, next;
267
+ };
268
+ }, exports.values = values, Context.prototype = {
269
+ constructor: Context,
270
+ reset: function (skipTempReset) {
271
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
272
+ },
273
+ stop: function () {
274
+ this.done = !0;
275
+ var rootRecord = this.tryEntries[0].completion;
276
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
650
277
  return this.rval;
651
278
  },
652
-
653
- dispatchException: function(exception) {
654
- if (this.done) {
655
- throw exception;
656
- }
657
-
279
+ dispatchException: function (exception) {
280
+ if (this.done) throw exception;
658
281
  var context = this;
659
- function handle(loc, caught) {
660
- record.type = "throw";
661
- record.arg = exception;
662
- context.next = loc;
663
-
664
- if (caught) {
665
- // If the dispatched exception was caught by a catch block,
666
- // then let that catch block handle the exception normally.
667
- context.method = "next";
668
- context.arg = undefined$1;
669
- }
670
282
 
671
- return !! caught;
283
+ function handle(loc, caught) {
284
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
672
285
  }
673
286
 
674
287
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
675
- var entry = this.tryEntries[i];
676
- var record = entry.completion;
677
-
678
- if (entry.tryLoc === "root") {
679
- // Exception thrown outside of any try block that could handle
680
- // it, so set the completion value of the entire function to
681
- // throw the exception.
682
- return handle("end");
683
- }
288
+ var entry = this.tryEntries[i],
289
+ record = entry.completion;
290
+ if ("root" === entry.tryLoc) return handle("end");
684
291
 
685
292
  if (entry.tryLoc <= this.prev) {
686
- var hasCatch = hasOwn.call(entry, "catchLoc");
687
- var hasFinally = hasOwn.call(entry, "finallyLoc");
293
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
294
+ hasFinally = hasOwn.call(entry, "finallyLoc");
688
295
 
689
296
  if (hasCatch && hasFinally) {
690
- if (this.prev < entry.catchLoc) {
691
- return handle(entry.catchLoc, true);
692
- } else if (this.prev < entry.finallyLoc) {
693
- return handle(entry.finallyLoc);
694
- }
695
-
297
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
298
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
696
299
  } else if (hasCatch) {
697
- if (this.prev < entry.catchLoc) {
698
- return handle(entry.catchLoc, true);
699
- }
700
-
701
- } else if (hasFinally) {
702
- if (this.prev < entry.finallyLoc) {
703
- return handle(entry.finallyLoc);
704
- }
705
-
300
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
706
301
  } else {
707
- throw new Error("try statement without catch or finally");
302
+ if (!hasFinally) throw new Error("try statement without catch or finally");
303
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
708
304
  }
709
305
  }
710
306
  }
711
307
  },
712
-
713
- abrupt: function(type, arg) {
308
+ abrupt: function (type, arg) {
714
309
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
715
310
  var entry = this.tryEntries[i];
716
- if (entry.tryLoc <= this.prev &&
717
- hasOwn.call(entry, "finallyLoc") &&
718
- this.prev < entry.finallyLoc) {
311
+
312
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
719
313
  var finallyEntry = entry;
720
314
  break;
721
315
  }
722
316
  }
723
317
 
724
- if (finallyEntry &&
725
- (type === "break" ||
726
- type === "continue") &&
727
- finallyEntry.tryLoc <= arg &&
728
- arg <= finallyEntry.finallyLoc) {
729
- // Ignore the finally entry if control is not jumping to a
730
- // location outside the try/catch block.
731
- finallyEntry = null;
732
- }
733
-
318
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
734
319
  var record = finallyEntry ? finallyEntry.completion : {};
735
- record.type = type;
736
- record.arg = arg;
737
-
738
- if (finallyEntry) {
739
- this.method = "next";
740
- this.next = finallyEntry.finallyLoc;
741
- return ContinueSentinel;
742
- }
743
-
744
- return this.complete(record);
320
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
745
321
  },
746
-
747
- complete: function(record, afterLoc) {
748
- if (record.type === "throw") {
749
- throw record.arg;
750
- }
751
-
752
- if (record.type === "break" ||
753
- record.type === "continue") {
754
- this.next = record.arg;
755
- } else if (record.type === "return") {
756
- this.rval = this.arg = record.arg;
757
- this.method = "return";
758
- this.next = "end";
759
- } else if (record.type === "normal" && afterLoc) {
760
- this.next = afterLoc;
761
- }
762
-
763
- return ContinueSentinel;
322
+ complete: function (record, afterLoc) {
323
+ if ("throw" === record.type) throw record.arg;
324
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
764
325
  },
765
-
766
- finish: function(finallyLoc) {
326
+ finish: function (finallyLoc) {
767
327
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
768
328
  var entry = this.tryEntries[i];
769
- if (entry.finallyLoc === finallyLoc) {
770
- this.complete(entry.completion, entry.afterLoc);
771
- resetTryEntry(entry);
772
- return ContinueSentinel;
773
- }
329
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
774
330
  }
775
331
  },
776
-
777
- "catch": function(tryLoc) {
332
+ catch: function (tryLoc) {
778
333
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
779
334
  var entry = this.tryEntries[i];
335
+
780
336
  if (entry.tryLoc === tryLoc) {
781
337
  var record = entry.completion;
782
- if (record.type === "throw") {
338
+
339
+ if ("throw" === record.type) {
783
340
  var thrown = record.arg;
784
341
  resetTryEntry(entry);
785
342
  }
343
+
786
344
  return thrown;
787
345
  }
788
346
  }
789
347
 
790
- // The context.catch method must only be called with a location
791
- // argument that corresponds to a known catch block.
792
348
  throw new Error("illegal catch attempt");
793
349
  },
794
-
795
- delegateYield: function(iterable, resultName, nextLoc) {
796
- this.delegate = {
350
+ delegateYield: function (iterable, resultName, nextLoc) {
351
+ return this.delegate = {
797
352
  iterator: values(iterable),
798
353
  resultName: resultName,
799
354
  nextLoc: nextLoc
800
- };
355
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
356
+ }
357
+ }, exports;
358
+ }
359
+
360
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
361
+ try {
362
+ var info = gen[key](arg);
363
+ var value = info.value;
364
+ } catch (error) {
365
+ reject(error);
366
+ return;
367
+ }
368
+
369
+ if (info.done) {
370
+ resolve(value);
371
+ } else {
372
+ Promise.resolve(value).then(_next, _throw);
373
+ }
374
+ }
375
+
376
+ function _asyncToGenerator(fn) {
377
+ return function () {
378
+ var self = this,
379
+ args = arguments;
380
+ return new Promise(function (resolve, reject) {
381
+ var gen = fn.apply(self, args);
382
+
383
+ function _next(value) {
384
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
385
+ }
801
386
 
802
- if (this.method === "next") {
803
- // Deliberately forget the last sent value so that we don't
804
- // accidentally pass it on to the delegate.
805
- this.arg = undefined$1;
387
+ function _throw(err) {
388
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
806
389
  }
807
390
 
808
- return ContinueSentinel;
809
- }
810
- };
391
+ _next(undefined);
392
+ });
393
+ };
394
+ }
395
+
396
+ function _extends() {
397
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
398
+ for (var i = 1; i < arguments.length; i++) {
399
+ var source = arguments[i];
400
+
401
+ for (var key in source) {
402
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
403
+ target[key] = source[key];
404
+ }
405
+ }
406
+ }
407
+
408
+ return target;
409
+ };
410
+ return _extends.apply(this, arguments);
411
+ }
412
+
413
+ function _objectDestructuringEmpty(obj) {
414
+ if (obj == null) throw new TypeError("Cannot destructure undefined");
415
+ }
416
+
417
+ function _objectWithoutPropertiesLoose(source, excluded) {
418
+ if (source == null) return {};
419
+ var target = {};
420
+ var sourceKeys = Object.keys(source);
421
+ var key, i;
422
+
423
+ for (i = 0; i < sourceKeys.length; i++) {
424
+ key = sourceKeys[i];
425
+ if (excluded.indexOf(key) >= 0) continue;
426
+ target[key] = source[key];
427
+ }
811
428
 
812
- // Regardless of whether this script is executing as a CommonJS module
813
- // or not, return the runtime object so that we can declare the variable
814
- // regeneratorRuntime in the outer scope, which allows this module to be
815
- // injected easily by `bin/regenerator --include-runtime script.js`.
816
- return exports;
817
-
818
- }(
819
- // If this script is executing as a CommonJS module, use module.exports
820
- // as the regeneratorRuntime namespace. Otherwise create a new empty
821
- // object. Either way, the resulting object will be used to initialize
822
- // the regeneratorRuntime variable at the top of this file.
823
- module.exports
824
- ));
825
-
826
- try {
827
- regeneratorRuntime = runtime;
828
- } catch (accidentalStrictMode) {
829
- // This module should not be running in strict mode, so the above
830
- // assignment should always work unless something is misconfigured. Just
831
- // in case runtime.js accidentally runs in strict mode, we can escape
832
- // strict mode using a global Function call. This could conceivably fail
833
- // if a Content Security Policy forbids using Function, but in that case
834
- // the proper solution is to fix the accidental strict mode problem. If
835
- // you've misconfigured your bundler to force strict mode and applied a
836
- // CSP to forbid Function, and you're not willing to fix either of those
837
- // problems, please detail your unique predicament in a GitHub issue.
838
- Function("r", "regeneratorRuntime = r")(runtime);
429
+ return target;
839
430
  }
840
- });
841
431
 
842
432
  var _require = /*#__PURE__*/require('@freelog/resource-policy-lang'),
843
433
  compile = _require.compile;
@@ -896,9 +486,9 @@ function policyCodeTranslationToText(_x, _x2) {
896
486
  }
897
487
 
898
488
  function _policyCodeTranslationToText() {
899
- _policyCodeTranslationToText = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(code, targetType) {
489
+ _policyCodeTranslationToText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, targetType) {
900
490
  var result, contract, rrr;
901
- return runtime_1.wrap(function _callee$(_context) {
491
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
902
492
  while (1) {
903
493
  switch (_context.prev = _context.next) {
904
494
  case 0:
@@ -1318,257 +908,11 @@ var Predefined = {
1318
908
  __proto__: null,
1319
909
  resourceTypes: resourceTypes,
1320
910
  pageSize: pageSize,
1321
- momentDateFormat: momentDateFormat,
1322
- momentDateTimeFormat: momentDateTimeFormat,
1323
- get EnumContractPartyIdentityType () { return EnumContractPartyIdentityType; },
1324
- get EnumSubjectType () { return EnumSubjectType; },
1325
- get EnumContractStatus () { return EnumContractStatus; }
1326
- };
1327
-
1328
- var codeMessage = {
1329
- 200: '服务器成功返回请求的数据。',
1330
- 201: '新建或修改数据成功。',
1331
- 202: '一个请求已经进入后台排队(异步任务)。',
1332
- 204: '删除数据成功。',
1333
- 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
1334
- 401: '用户没有权限(令牌、用户名、密码错误)。',
1335
- 403: '用户得到授权,但是访问是被禁止的。',
1336
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
1337
- 406: '请求的格式不可得。',
1338
- 410: '请求的资源被永久删除,且不会再得到的。',
1339
- 422: '当创建一个对象时,发生一个验证错误。',
1340
- 500: '服务器发生错误,请检查服务器。',
1341
- 502: '网关错误。',
1342
- 503: '服务不可用,服务器暂时过载或维护。',
1343
- 504: '网关超时。'
1344
- }; // export let apiHost: string = '';
1345
-
1346
- if (window.location.hostname.includes('.com')) {
1347
- // apiHost = `${window.location.protocol}//qi.${(window.location.host.match(/(?<=\.).*/) || [''])[0]}`;
1348
- // apiHost = window.location.origin.replace('console', 'qi');
1349
- axios.defaults.withCredentials = true;
1350
- axios.defaults.baseURL = /*#__PURE__*/completeUrlByDomain('qi');
1351
- }
1352
- /**
1353
- * 异常处理程序
1354
- */
1355
- // const errorHandler = (error: { response: Response }): Response => {
1356
- // const {response} = error;
1357
- // if (response && response.status) {
1358
- // const errorText = codeMessage[response.status] || response.statusText;
1359
- // const {status, url} = response;
1360
- //
1361
- // // notification.error({
1362
- // // message: `请求错误 ${status}: ${url}`,
1363
- // // description: errorText,
1364
- // // });
1365
- // } else if (!response) {
1366
- // // notification.error({
1367
- // // description: '您的网络发生异常,无法连接服务器',
1368
- // // message: '网络异常',
1369
- // // });
1370
- // }
1371
- // return response;
1372
- // };
1373
- //
1374
- // // Add a request interceptor
1375
-
1376
-
1377
- axios.interceptors.request.use(function (config) {
1378
- // Do something before request is sent
1379
- NProgress.start();
1380
- return config;
1381
- }, function (error) {
1382
- // Do something with request error
1383
- NProgress.done();
1384
- return Promise.reject(error);
1385
- });
1386
- /**
1387
- * 配置request请求时的默认参数
1388
- */
1389
-
1390
- axios.interceptors.response.use(function (response) {
1391
- var _headers$contentDisp;
1392
-
1393
- // Do something with response data
1394
- // console.log(response, 'response!!!!!!');
1395
- NProgress.done();
1396
-
1397
- if (response.status !== 200) {
1398
- var error = {
1399
- description: codeMessage[response.status],
1400
- message: response.status
1401
- }; // notification.error(error);
1402
-
1403
- throw new Error(JSON.stringify(error));
1404
- }
1405
-
1406
- var data = response.data,
1407
- headers = response.headers;
1408
-
1409
- if ((_headers$contentDisp = headers['content-disposition']) != null && _headers$contentDisp.includes('attachment;')) {
1410
- // downloadFile(response);
1411
- return;
1412
- } // console.log(data, 'data2390jasdflkf');
1413
- // if ((data.errcode === undefined
1414
- // ? (data.errCode !== 0 && data.errCode !== 2)
1415
- // : (data.errcode !== 0 && data.errcode !== 2))
1416
- // || data.ret !== 0) {
1417
- //
1418
- // // notification.error({
1419
- // // message: data.msg,
1420
- // // });
1421
- // throw new Error(JSON.stringify(data));
1422
- // }
1423
-
1424
-
1425
- return data;
1426
- }, function (error) {
1427
- // Do something with response error
1428
- NProgress.done();
1429
- return Promise.reject(error);
1430
- });
1431
- function request(_x, _x2) {
1432
- return _request.apply(this, arguments);
1433
- } // export function downloadFile(res: AxiosResponse) {
1434
- // const {data, headers} = res;
1435
- // // const fileName = headers['content-disposition'].replace(/attachment; filename="(.*)"/, '$1');
1436
- // const fileName = headers['content-disposition'].replace(/attachment; filename="(.*)"/, '$1');
1437
- // const blob = new Blob([data], {});
1438
- // FileSaver.saveAs(blob, fileName);
1439
- // }
1440
-
1441
- function _request() {
1442
- _request = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, _temp) {
1443
- var _ref, _ref$noRedirect, noRedirect, _ref$noErrorAlert, noErrorAlert, result;
1444
-
1445
- return runtime_1.wrap(function _callee$(_context) {
1446
- while (1) {
1447
- switch (_context.prev = _context.next) {
1448
- case 0:
1449
- _ref = _temp === void 0 ? {} : _temp, _ref$noRedirect = _ref.noRedirect, noRedirect = _ref$noRedirect === void 0 ? false : _ref$noRedirect, _ref$noErrorAlert = _ref.noErrorAlert, noErrorAlert = _ref$noErrorAlert === void 0 ? false : _ref$noErrorAlert;
1450
- _context.next = 3;
1451
- return axios.request(config);
1452
-
1453
- case 3:
1454
- result = _context.sent;
1455
-
1456
- if (!((result.errCode === 30 || result.errCode === 30) && !noRedirect)) {
1457
- _context.next = 6;
1458
- break;
1459
- }
1460
-
1461
- return _context.abrupt("return", window.location.replace("" + completeUrlByDomain('user') + login({
1462
- goTo: window.location.href
1463
- })));
1464
-
1465
- case 6:
1466
-
1467
- return _context.abrupt("return", result);
1468
-
1469
- case 8:
1470
- case "end":
1471
- return _context.stop();
1472
- }
1473
- }
1474
- }, _callee);
1475
- }));
1476
- return _request.apply(this, arguments);
1477
- }
1478
-
1479
- /**
1480
- * 根据 File 获取 SHA1 Hash 字符串
1481
- * @param file
1482
- * @return {Promise<string>}
1483
- */
1484
-
1485
- function getSHA1Hash(file) {
1486
- return new Promise(function (resolve) {
1487
- var reader = new FileReader();
1488
-
1489
- reader.onload = function () {
1490
- var wordArray = CryptoJS.lib.WordArray.create(reader.result);
1491
- var hash = CryptoJS.SHA1(wordArray).toString();
1492
- resolve(hash);
1493
- };
1494
-
1495
- reader.readAsArrayBuffer(file);
1496
- });
1497
- }
1498
- /**
1499
- * 生成随机码
1500
- */
1501
-
1502
- function generateRandomCode(strLen) {
1503
- if (strLen === void 0) {
1504
- strLen = 5;
1505
- }
1506
-
1507
- var allStr = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
1508
- var newStrArr = [];
1509
-
1510
- for (var i = 0; i < strLen; i++) {
1511
- newStrArr.push(allStr[Math.floor(Math.random() * 61)]);
1512
- }
1513
-
1514
- return newStrArr.join('');
1515
- }
1516
- /**
1517
- * 通过读取 cookies 获取用户 ID
1518
- */
1519
-
1520
- function getUserIDByCookies() {
1521
- var uid = document.cookie.split('; ').find(function (co) {
1522
- return co.startsWith('uid=');
1523
- });
1524
-
1525
- if (!uid) {
1526
- return -1;
1527
- }
1528
-
1529
- return Number(uid.replace('uid=', ''));
1530
- }
1531
- function transformServerAPIContractState(_ref) {
1532
- var status = _ref.status,
1533
- authStatus = _ref.authStatus;
1534
-
1535
- if (status === 0) {
1536
- if (authStatus === 1 || authStatus === 3) {
1537
- return 'active';
1538
- }
1539
-
1540
- if (authStatus === 2) {
1541
- return 'testActive';
1542
- }
1543
-
1544
- if (authStatus === 128) {
1545
- return 'inactive';
1546
- }
1547
- }
1548
-
1549
- if (status === 1) {
1550
- return 'terminal';
1551
- }
1552
-
1553
- return 'exception';
1554
- }
1555
-
1556
- var Tool = {
1557
- __proto__: null,
1558
- getSHA1Hash: getSHA1Hash,
1559
- generateRandomCode: generateRandomCode,
1560
- getUserIDByCookies: getUserIDByCookies,
1561
- transformServerAPIContractState: transformServerAPIContractState
1562
- };
1563
-
1564
- var FUtil = {
1565
- Format: Format,
1566
- Regexp: Regexp,
1567
- LinkTo: LinkTo,
1568
- Predefined: Predefined,
1569
- Axios: axios,
1570
- Request: request,
1571
- Tool: Tool
911
+ momentDateFormat: momentDateFormat,
912
+ momentDateTimeFormat: momentDateTimeFormat,
913
+ get EnumContractPartyIdentityType () { return EnumContractPartyIdentityType; },
914
+ get EnumSubjectType () { return EnumSubjectType; },
915
+ get EnumContractStatus () { return EnumContractStatus; }
1572
916
  };
1573
917
 
1574
918
  function create(params) {
@@ -2843,11 +2187,27 @@ function find4Client(params) {
2843
2187
  params: params
2844
2188
  });
2845
2189
  }
2190
+ function adsList(params) {
2191
+ return FUtil.Request({
2192
+ method: 'GET',
2193
+ url: "/v2/activities/ads/list4Client",
2194
+ params: params
2195
+ });
2196
+ }
2197
+ function adsDetails(params) {
2198
+ return FUtil.Request({
2199
+ method: 'GET',
2200
+ url: "/v2/activities/ads/find4Client",
2201
+ params: params
2202
+ });
2203
+ }
2846
2204
 
2847
2205
  var Activity = {
2848
2206
  __proto__: null,
2849
2207
  list4Client: list4Client,
2850
- find4Client: find4Client
2208
+ find4Client: find4Client,
2209
+ adsList: adsList,
2210
+ adsDetails: adsDetails
2851
2211
  };
2852
2212
 
2853
2213
  var FServiceAPI = {
@@ -2865,6 +2225,256 @@ var FServiceAPI = {
2865
2225
  Activity: Activity
2866
2226
  };
2867
2227
 
2228
+ var codeMessage = {
2229
+ 200: '服务器成功返回请求的数据。',
2230
+ 201: '新建或修改数据成功。',
2231
+ 202: '一个请求已经进入后台排队(异步任务)。',
2232
+ 204: '删除数据成功。',
2233
+ 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
2234
+ 401: '用户没有权限(令牌、用户名、密码错误)。',
2235
+ 403: '用户得到授权,但是访问是被禁止的。',
2236
+ 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
2237
+ 406: '请求的格式不可得。',
2238
+ 410: '请求的资源被永久删除,且不会再得到的。',
2239
+ 422: '当创建一个对象时,发生一个验证错误。',
2240
+ 500: '服务器发生错误,请检查服务器。',
2241
+ 502: '网关错误。',
2242
+ 503: '服务不可用,服务器暂时过载或维护。',
2243
+ 504: '网关超时。'
2244
+ }; // export let apiHost: string = '';
2245
+
2246
+ if (window.location.hostname.includes('.com')) {
2247
+ // apiHost = `${window.location.protocol}//qi.${(window.location.host.match(/(?<=\.).*/) || [''])[0]}`;
2248
+ // apiHost = window.location.origin.replace('console', 'qi');
2249
+ axios.defaults.withCredentials = true;
2250
+ axios.defaults.baseURL = /*#__PURE__*/completeUrlByDomain('qi');
2251
+ }
2252
+ /**
2253
+ * 异常处理程序
2254
+ */
2255
+ // const errorHandler = (error: { response: Response }): Response => {
2256
+ // const {response} = error;
2257
+ // if (response && response.status) {
2258
+ // const errorText = codeMessage[response.status] || response.statusText;
2259
+ // const {status, url} = response;
2260
+ //
2261
+ // // notification.error({
2262
+ // // message: `请求错误 ${status}: ${url}`,
2263
+ // // description: errorText,
2264
+ // // });
2265
+ // } else if (!response) {
2266
+ // // notification.error({
2267
+ // // description: '您的网络发生异常,无法连接服务器',
2268
+ // // message: '网络异常',
2269
+ // // });
2270
+ // }
2271
+ // return response;
2272
+ // };
2273
+ //
2274
+ // // Add a request interceptor
2275
+
2276
+
2277
+ axios.interceptors.request.use(function (config) {
2278
+ // Do something before request is sent
2279
+ NProgress.start();
2280
+ return config;
2281
+ }, function (error) {
2282
+ // Do something with request error
2283
+ NProgress.done();
2284
+ return Promise.reject(error);
2285
+ });
2286
+ /**
2287
+ * 配置request请求时的默认参数
2288
+ */
2289
+
2290
+ axios.interceptors.response.use(function (response) {
2291
+ var _headers$contentDisp;
2292
+
2293
+ // Do something with response data
2294
+ // console.log(response, 'response!!!!!!');
2295
+ NProgress.done();
2296
+
2297
+ if (response.status !== 200) {
2298
+ var error = {
2299
+ description: codeMessage[response.status],
2300
+ message: response.status
2301
+ }; // notification.error(error);
2302
+
2303
+ throw new Error(JSON.stringify(error));
2304
+ }
2305
+
2306
+ var data = response.data,
2307
+ headers = response.headers;
2308
+
2309
+ if ((_headers$contentDisp = headers['content-disposition']) != null && _headers$contentDisp.includes('attachment;')) {
2310
+ // downloadFile(response);
2311
+ return;
2312
+ } // console.log(data, 'data2390jasdflkf');
2313
+ // if ((data.errcode === undefined
2314
+ // ? (data.errCode !== 0 && data.errCode !== 2)
2315
+ // : (data.errcode !== 0 && data.errcode !== 2))
2316
+ // || data.ret !== 0) {
2317
+ //
2318
+ // // notification.error({
2319
+ // // message: data.msg,
2320
+ // // });
2321
+ // throw new Error(JSON.stringify(data));
2322
+ // }
2323
+
2324
+
2325
+ return data;
2326
+ }, function (error) {
2327
+ // Do something with response error
2328
+ NProgress.done();
2329
+ return Promise.reject(error);
2330
+ });
2331
+ function request(_x, _x2) {
2332
+ return _request.apply(this, arguments);
2333
+ } // export function downloadFile(res: AxiosResponse) {
2334
+ // const {data, headers} = res;
2335
+ // // const fileName = headers['content-disposition'].replace(/attachment; filename="(.*)"/, '$1');
2336
+ // const fileName = headers['content-disposition'].replace(/attachment; filename="(.*)"/, '$1');
2337
+ // const blob = new Blob([data], {});
2338
+ // FileSaver.saveAs(blob, fileName);
2339
+ // }
2340
+
2341
+ function _request() {
2342
+ _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, _temp) {
2343
+ var _ref, _ref$noRedirect, noRedirect, _ref$noErrorAlert, noErrorAlert, result;
2344
+
2345
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2346
+ while (1) {
2347
+ switch (_context.prev = _context.next) {
2348
+ case 0:
2349
+ _ref = _temp === void 0 ? {} : _temp, _ref$noRedirect = _ref.noRedirect, noRedirect = _ref$noRedirect === void 0 ? false : _ref$noRedirect, _ref$noErrorAlert = _ref.noErrorAlert, noErrorAlert = _ref$noErrorAlert === void 0 ? false : _ref$noErrorAlert;
2350
+ _context.next = 3;
2351
+ return axios.request(config);
2352
+
2353
+ case 3:
2354
+ result = _context.sent;
2355
+
2356
+ if (!((result.errCode === 30 || result.errCode === 30) && !noRedirect)) {
2357
+ _context.next = 8;
2358
+ break;
2359
+ }
2360
+
2361
+ _context.next = 7;
2362
+ return FServiceAPI.User.logout();
2363
+
2364
+ case 7:
2365
+ window.location.replace("" + completeUrlByDomain('user') + login({
2366
+ goTo: window.location.href
2367
+ }));
2368
+
2369
+ case 8:
2370
+
2371
+ return _context.abrupt("return", result);
2372
+
2373
+ case 10:
2374
+ case "end":
2375
+ return _context.stop();
2376
+ }
2377
+ }
2378
+ }, _callee);
2379
+ }));
2380
+ return _request.apply(this, arguments);
2381
+ }
2382
+
2383
+ /**
2384
+ * 根据 File 获取 SHA1 Hash 字符串
2385
+ * @param file
2386
+ * @return {Promise<string>}
2387
+ */
2388
+
2389
+ function getSHA1Hash(file) {
2390
+ return new Promise(function (resolve) {
2391
+ var reader = new FileReader();
2392
+
2393
+ reader.onload = function () {
2394
+ var wordArray = CryptoJS.lib.WordArray.create(reader.result);
2395
+ var hash = CryptoJS.SHA1(wordArray).toString();
2396
+ resolve(hash);
2397
+ };
2398
+
2399
+ reader.readAsArrayBuffer(file);
2400
+ });
2401
+ }
2402
+ /**
2403
+ * 生成随机码
2404
+ */
2405
+
2406
+ function generateRandomCode(strLen) {
2407
+ if (strLen === void 0) {
2408
+ strLen = 5;
2409
+ }
2410
+
2411
+ var allStr = 'ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
2412
+ var newStrArr = [];
2413
+
2414
+ for (var i = 0; i < strLen; i++) {
2415
+ newStrArr.push(allStr[Math.floor(Math.random() * 61)]);
2416
+ }
2417
+
2418
+ return newStrArr.join('');
2419
+ }
2420
+ /**
2421
+ * 通过读取 cookies 获取用户 ID
2422
+ */
2423
+
2424
+ function getUserIDByCookies() {
2425
+ var uid = document.cookie.split('; ').find(function (co) {
2426
+ return co.startsWith('uid=');
2427
+ });
2428
+
2429
+ if (!uid) {
2430
+ return -1;
2431
+ }
2432
+
2433
+ return Number(uid.replace('uid=', ''));
2434
+ }
2435
+ function transformServerAPIContractState(_ref) {
2436
+ var status = _ref.status,
2437
+ authStatus = _ref.authStatus;
2438
+
2439
+ if (status === 0) {
2440
+ if (authStatus === 1 || authStatus === 3) {
2441
+ return 'active';
2442
+ }
2443
+
2444
+ if (authStatus === 2) {
2445
+ return 'testActive';
2446
+ }
2447
+
2448
+ if (authStatus === 128) {
2449
+ return 'inactive';
2450
+ }
2451
+ }
2452
+
2453
+ if (status === 1) {
2454
+ return 'terminal';
2455
+ }
2456
+
2457
+ return 'exception';
2458
+ }
2459
+
2460
+ var Tool = {
2461
+ __proto__: null,
2462
+ getSHA1Hash: getSHA1Hash,
2463
+ generateRandomCode: generateRandomCode,
2464
+ getUserIDByCookies: getUserIDByCookies,
2465
+ transformServerAPIContractState: transformServerAPIContractState
2466
+ };
2467
+
2468
+ var FUtil = {
2469
+ Format: Format,
2470
+ Regexp: Regexp,
2471
+ LinkTo: LinkTo,
2472
+ Predefined: Predefined,
2473
+ Axios: axios,
2474
+ Request: request,
2475
+ Tool: Tool
2476
+ };
2477
+
2868
2478
  exports.FServiceAPI = FServiceAPI;
2869
2479
  exports.FUtil = FUtil;
2870
2480
  //# sourceMappingURL=tools-lib.cjs.development.js.map