@solibo/solibo-sdk 1.1.31 → 1.1.32

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/index.d.ts CHANGED
@@ -1,5 +1,58 @@
1
1
  // Re-export everything from the ESM bundles
2
2
  export * from './solibo-sdk-sdk.mjs';
3
3
  export * from './solibo-sdk-sdk-home-api.mjs';
4
- // Explicitly re-export bridge types to resolve ESM ambiguity
5
- export { KtList, KtMap, KtMutableList, KtMutableMap } from './solibo-sdk-sdk.mjs';
4
+ // Augment bridge types with JS collection methods
5
+ declare module './solibo-sdk-sdk.mjs' {
6
+ interface KtList<E> {
7
+ map<U>(callback: (value: E, index: number, array: ReadonlyArray<E>) => U, thisArg?: any): U[];
8
+ filter(callback: (value: E, index: number, array: ReadonlyArray<E>) => boolean, thisArg?: any): E[];
9
+ forEach(callback: (value: E, index: number, array: ReadonlyArray<E>) => void, thisArg?: any): void;
10
+ reduce<U>(callback: (accumulator: U, value: E, index: number, array: ReadonlyArray<E>) => U, initialValue: U): U;
11
+ find(callback: (value: E, index: number, array: ReadonlyArray<E>) => boolean, thisArg?: any): E | undefined;
12
+ findIndex(callback: (value: E, index: number, array: ReadonlyArray<E>) => boolean, thisArg?: any): number;
13
+ some(callback: (value: E, index: number, array: ReadonlyArray<E>) => boolean, thisArg?: any): boolean;
14
+ every(callback: (value: E, index: number, array: ReadonlyArray<E>) => boolean, thisArg?: any): boolean;
15
+ includes(searchElement: E, fromIndex?: number): boolean;
16
+ indexOf(searchElement: E, fromIndex?: number): number;
17
+ lastIndexOf(searchElement: E, fromIndex?: number): number;
18
+ at(index: number): E | undefined;
19
+ join(separator?: string): string;
20
+ slice(start?: number, end?: number): E[];
21
+ [Symbol.iterator](): IterableIterator<E>;
22
+ }
23
+ interface KtMap<K, V> {
24
+ get(key: K): V | undefined;
25
+ has(key: K): boolean;
26
+ forEach(callback: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;
27
+ keys(): IterableIterator<K>;
28
+ values(): IterableIterator<V>;
29
+ entries(): IterableIterator<[K, V]>;
30
+ [Symbol.iterator](): IterableIterator<[K, V]>;
31
+ }
32
+ interface KtMutableList<E> {
33
+ map<U>(callback: (value: E, index: number, array: Array<E>) => U, thisArg?: any): U[];
34
+ filter(callback: (value: E, index: number, array: Array<E>) => boolean, thisArg?: any): E[];
35
+ forEach(callback: (value: E, index: number, array: Array<E>) => void, thisArg?: any): void;
36
+ reduce<U>(callback: (accumulator: U, value: E, index: number, array: Array<E>) => U, initialValue: U): U;
37
+ find(callback: (value: E, index: number, array: Array<E>) => boolean, thisArg?: any): E | undefined;
38
+ findIndex(callback: (value: E, index: number, array: Array<E>) => boolean, thisArg?: any): number;
39
+ some(callback: (value: E, index: number, array: Array<E>) => boolean, thisArg?: any): boolean;
40
+ every(callback: (value: E, index: number, array: Array<E>) => boolean, thisArg?: any): boolean;
41
+ includes(searchElement: E, fromIndex?: number): boolean;
42
+ indexOf(searchElement: E, fromIndex?: number): number;
43
+ lastIndexOf(searchElement: E, fromIndex?: number): number;
44
+ at(index: number): E | undefined;
45
+ join(separator?: string): string;
46
+ slice(start?: number, end?: number): E[];
47
+ [Symbol.iterator](): IterableIterator<E>;
48
+ }
49
+ interface KtMutableMap<K, V> {
50
+ get(key: K): V | undefined;
51
+ has(key: K): boolean;
52
+ forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
53
+ keys(): IterableIterator<K>;
54
+ values(): IterableIterator<V>;
55
+ entries(): IterableIterator<[K, V]>;
56
+ [Symbol.iterator](): IterableIterator<[K, V]>;
57
+ }
58
+ }
package/index.mjs CHANGED
@@ -1,11 +1,54 @@
1
1
  // Re-export everything from the ESM bundles
2
2
  export * from './solibo-sdk-sdk.mjs';
3
3
  export * from './solibo-sdk-sdk-home-api.mjs';
4
- // Explicitly re-export bridge types from stdlib to resolve ESM ambiguity
5
- export {
4
+ // Import bridge types from stdlib to polyfill and re-export them
5
+ import {
6
6
  KtList,
7
7
  KtMap,
8
8
  KtMutableList,
9
9
  KtMutableMap,
10
- Instant2s2zyzgfc4947 as Instant,
10
+ Instant2s2zyzgfc4947 as Instant_Internal,
11
11
  } from './kotlin-kotlin-stdlib.mjs';
12
+
13
+
14
+ // Polyfill for KtList, KtMap, KtSet to support JS collection methods directly
15
+ (function() {
16
+ if (typeof KtList !== 'undefined' && KtList.fromJsArray) {
17
+ const proto = Object.getPrototypeOf(KtList.fromJsArray([]));
18
+ if (proto && !proto.map) {
19
+ const arrayMethods = ['map', 'filter', 'forEach', 'reduce', 'reduceRight', 'find', 'findIndex', 'some', 'every', 'includes', 'indexOf', 'lastIndexOf', 'at', 'join', 'slice', 'flat', 'flatMap'];
20
+ arrayMethods.forEach(name => {
21
+ if (!proto[name]) proto[name] = function(...args) { return this.asJsReadonlyArrayView()[name](...args); };
22
+ });
23
+ if (!proto[Symbol.iterator]) proto[Symbol.iterator] = function() { return this.asJsReadonlyArrayView()[Symbol.iterator](); };
24
+ }
25
+ }
26
+ if (typeof KtMap !== 'undefined' && KtMap.fromJsMap) {
27
+ const proto = Object.getPrototypeOf(KtMap.fromJsMap(new Map()));
28
+ if (proto && !proto.get) {
29
+ const mapMethods = ['get', 'has', 'keys', 'values', 'entries', 'forEach'];
30
+ mapMethods.forEach(name => {
31
+ if (!proto[name]) proto[name] = function(...args) { return this.asJsReadonlyMapView()[name](...args); };
32
+ });
33
+ if (!proto[Symbol.iterator]) proto[Symbol.iterator] = function() { return this.asJsReadonlyMapView()[Symbol.iterator](); };
34
+ }
35
+ }
36
+ if (typeof KtSet !== 'undefined' && KtSet.fromJsSet) {
37
+ const proto = Object.getPrototypeOf(KtSet.fromJsSet(new Set()));
38
+ if (proto && !proto.has) {
39
+ const setMethods = ['has', 'keys', 'values', 'entries', 'forEach'];
40
+ setMethods.forEach(name => {
41
+ if (!proto[name]) proto[name] = function(...args) { return this.asJsReadonlySetView()[name](...args); };
42
+ });
43
+ if (!proto[Symbol.iterator]) proto[Symbol.iterator] = function() { return this.asJsReadonlySetView()[Symbol.iterator](); };
44
+ }
45
+ }
46
+ })();
47
+
48
+ export {
49
+ KtList,
50
+ KtMap,
51
+ KtMutableList,
52
+ KtMutableMap,
53
+ Instant_Internal as Instant,
54
+ };
@@ -37,17 +37,6 @@ if (typeof Array.prototype.fill === 'undefined') {
37
37
  Object.defineProperty(TypedArray.prototype, 'fill', {value: Array.prototype.fill});
38
38
  }
39
39
  });
40
- if (typeof Math.clz32 === 'undefined') {
41
- Math.clz32 = function (log, LN2) {
42
- return function (x) {
43
- var asUint = x >>> 0;
44
- if (asUint === 0) {
45
- return 32;
46
- }
47
- return 31 - (log(asUint) / LN2 | 0) | 0; // the "| 0" acts like math.floor
48
- };
49
- }(Math.log, Math.LN2);
50
- }
51
40
  if (typeof Math.trunc === 'undefined') {
52
41
  Math.trunc = function (x) {
53
42
  if (isNaN(x)) {
@@ -64,6 +53,17 @@ if (typeof Math.log10 === 'undefined') {
64
53
  return Math.log(x) * Math.LOG10E;
65
54
  };
66
55
  }
56
+ if (typeof Math.clz32 === 'undefined') {
57
+ Math.clz32 = function (log, LN2) {
58
+ return function (x) {
59
+ var asUint = x >>> 0;
60
+ if (asUint === 0) {
61
+ return 32;
62
+ }
63
+ return 31 - (log(asUint) / LN2 | 0) | 0; // the "| 0" acts like math.floor
64
+ };
65
+ }(Math.log, Math.LN2);
66
+ }
67
67
  if (typeof String.prototype.endsWith === 'undefined') {
68
68
  Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) {
69
69
  var subjectString = this.toString();
@@ -224,6 +224,11 @@ initMetadataForClass(SendBroadcast, 'SendBroadcast', VOID, VOID, [Waiter]);
224
224
  initMetadataForClass(BufferedChannelIterator, 'BufferedChannelIterator', VOID, VOID, [Waiter], [0, 3]);
225
225
  initMetadataForCoroutine($sendCOROUTINE$, CoroutineImpl);
226
226
  initMetadataForCoroutine($receiveCOROUTINE$, CoroutineImpl);
227
+ function close$default(cause, $super) {
228
+ cause = cause === VOID ? null : cause;
229
+ return $super === VOID ? this.y2p(cause) : $super.y2p.call(this, cause);
230
+ }
231
+ initMetadataForInterface(SendChannel, 'SendChannel', VOID, VOID, VOID, [1]);
227
232
  function cancel$default_0(cause, $super) {
228
233
  cause = cause === VOID ? null : cause;
229
234
  var tmp;
@@ -236,12 +241,7 @@ function cancel$default_0(cause, $super) {
236
241
  return tmp;
237
242
  }
238
243
  initMetadataForInterface(ReceiveChannel, 'ReceiveChannel', VOID, VOID, VOID, [0]);
239
- function close$default(cause, $super) {
240
- cause = cause === VOID ? null : cause;
241
- return $super === VOID ? this.y2p(cause) : $super.y2p.call(this, cause);
242
- }
243
- initMetadataForInterface(SendChannel, 'SendChannel', VOID, VOID, VOID, [1]);
244
- initMetadataForClass(BufferedChannel, 'BufferedChannel', VOID, VOID, [ReceiveChannel, SendChannel], [1, 4, 0, 3]);
244
+ initMetadataForClass(BufferedChannel, 'BufferedChannel', VOID, VOID, [SendChannel, ReceiveChannel], [1, 4, 0, 3]);
245
245
  initMetadataForClass(WaiterEB, 'WaiterEB');
246
246
  initMetadataForClass(ReceiveCatching, 'ReceiveCatching', VOID, VOID, [Waiter]);
247
247
  initMetadataForObject(Factory, 'Factory');
@@ -251,7 +251,7 @@ initMetadataForCompanion(Companion);
251
251
  initMetadataForClass(ChannelResult, 'ChannelResult');
252
252
  initMetadataForClass(ClosedReceiveChannelException, 'ClosedReceiveChannelException', VOID, NoSuchElementException);
253
253
  initMetadataForClass(ClosedSendChannelException, 'ClosedSendChannelException', VOID, IllegalStateException);
254
- initMetadataForClass(ChannelCoroutine, 'ChannelCoroutine', VOID, AbstractCoroutine, [AbstractCoroutine, ReceiveChannel, SendChannel], [1, 0]);
254
+ initMetadataForClass(ChannelCoroutine, 'ChannelCoroutine', VOID, AbstractCoroutine, [AbstractCoroutine, SendChannel, ReceiveChannel], [1, 0]);
255
255
  initMetadataForClass(ConflatedBufferedChannel, 'ConflatedBufferedChannel', VOID, BufferedChannel, VOID, [1, 0]);
256
256
  initMetadataForInterface(ProducerScope, 'ProducerScope', VOID, VOID, [CoroutineScope, SendChannel], [1]);
257
257
  initMetadataForClass(ProducerCoroutine, 'ProducerCoroutine', VOID, ChannelCoroutine, [ChannelCoroutine, ProducerScope], [1, 0]);
@@ -270,7 +270,7 @@ initMetadataForClass(ContextScope, 'ContextScope', VOID, VOID, [CoroutineScope])
270
270
  initMetadataForClass(Symbol, 'Symbol');
271
271
  initMetadataForInterface(SelectInstance, 'SelectInstance');
272
272
  initMetadataForClass(ClauseData, 'ClauseData', VOID, VOID, VOID, [1]);
273
- initMetadataForClass(SelectImplementation, 'SelectImplementation', VOID, VOID, [CancelHandler, SelectInstance, Waiter], [0, 2]);
273
+ initMetadataForClass(SelectImplementation, 'SelectImplementation', VOID, VOID, [CancelHandler, Waiter, SelectInstance], [0, 2]);
274
274
  initMetadataForClass(TrySelectDetailedResult, 'TrySelectDetailedResult', VOID, Enum);
275
275
  function tryLock$default(owner, $super) {
276
276
  owner = owner === VOID ? null : owner;