Skip to content

Commit

Permalink
Make TS wrappers and tests ES modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Whathecode committed Feb 17, 2024
1 parent 7169590 commit 9921f04
Show file tree
Hide file tree
Showing 24 changed files with 134 additions and 111 deletions.
26 changes: 13 additions & 13 deletions typescript-declarations/carp-common/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as extend from "@cachet/carp-common-generated"
import * as kotlinStdLib from "@cachet/carp-kotlin"
import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization"
import extend from "@cachet/carp-common-generated"
import kotlinStdLib from "@cachet/carp-kotlin"
import kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import kotlinSerialization from "@cachet/carp-kotlinx-serialization"


declare module "@cachet/carp-common-generated"
{
// Declare missing types for which no imports were generated.
namespace kotlin
{
type Long = kotlinStdLib.kotlin.Long
type Long = kotlinStdLib.Long
}
namespace kotlin.reflect
{
Expand All @@ -19,24 +19,24 @@ declare module "@cachet/carp-common-generated"
}
namespace kotlin.time
{
type Duration = kotlinStdLib.kotlin.time.Duration
type Duration = kotlinStdLib.time.Duration
}
namespace kotlin.collections
{
type List<T> = kotlinStdLib.kotlin.collections.List<T>
type Set<T> = kotlinStdLib.kotlin.collections.Set<T>
type Map<K, V> = kotlinStdLib.kotlin.collections.Map<K, V>
type List<T> = kotlinStdLib.collections.List<T>
type Set<T> = kotlinStdLib.collections.Set<T>
type Map<K, V> = kotlinStdLib.collections.Map<K, V>
}
namespace kotlinx.datetime
{
type Instant = kotlinDateTime.kotlinx.datetime.Instant
type Instant = kotlinDateTime.datetime.Instant
}
namespace kotlinx.serialization.json
{
type Json = kotlinSerialization.kotlinx.serialization.json.Json
type Json = kotlinSerialization.serialization.json.Json
}
}


// Export facade.
export * from "@cachet/carp-common-generated"
// Re-export augmented types.
export { default } from "@cachet/carp-common-generated"
2 changes: 2 additions & 0 deletions typescript-declarations/carp-common/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-common",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
2 changes: 1 addition & 1 deletion typescript-declarations/carp-data-core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as extend from "@cachet/carp-data-core-generated"
import * as kotlinStdLib from "@cachet/carp-kotlin"
import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization"
import * as carpCommon from "@cachet/carp-common"
import carpCommon from "@cachet/carp-common"


declare module "@cachet/carp-data-core-generated"
Expand Down
2 changes: 2 additions & 0 deletions typescript-declarations/carp-data-core/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-data-core",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
28 changes: 14 additions & 14 deletions typescript-declarations/carp-deployments-core/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as extend from "@cachet/carp-deployments-core-generated"
import * as kotlinStdLib from "@cachet/carp-kotlin"
import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization"
import * as carpCommon from "@cachet/carp-common"
import extend from "@cachet/carp-deployments-core-generated"
import kotlinStdLib from "@cachet/carp-kotlin"
import kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import kotlinSerialization from "@cachet/carp-kotlinx-serialization"
import carpCommon from "@cachet/carp-common"


declare module "@cachet/carp-deployments-core-generated"
{
// Declare missing types for which no imports were generated.
namespace kotlin
{
type Long = kotlinStdLib.kotlin.Long
type Long = kotlinStdLib.Long
}
namespace kotlin.reflect
{
Expand All @@ -20,21 +20,21 @@ declare module "@cachet/carp-deployments-core-generated"
}
namespace kotlin.time
{
type Duration = kotlinStdLib.kotlin.time.Duration
type Duration = kotlinStdLib.time.Duration
}
namespace kotlin.collections
{
type List<T> = kotlinStdLib.kotlin.collections.List<T>
type Set<T> = kotlinStdLib.kotlin.collections.Set<T>
type Map<K, V> = kotlinStdLib.kotlin.collections.Map<K, V>
type List<T> = kotlinStdLib.collections.List<T>
type Set<T> = kotlinStdLib.collections.Set<T>
type Map<K, V> = kotlinStdLib.collections.Map<K, V>
}
namespace kotlinx.datetime
{
type Instant = kotlinDateTime.kotlinx.datetime.Instant
type Instant = kotlinDateTime.datetime.Instant
}
namespace kotlinx.serialization.json
{
type Json = kotlinSerialization.kotlinx.serialization.json.Json
type Json = kotlinSerialization.serialization.json.Json
}
}

Expand All @@ -43,5 +43,5 @@ declare module "@cachet/carp-deployments-core-generated"
extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any;


// Export facade.
export * from "@cachet/carp-deployments-core-generated"
// Re-export augmented types.
export { default } from "@cachet/carp-deployments-core-generated"
2 changes: 2 additions & 0 deletions typescript-declarations/carp-deployments-core/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-deployments-core",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
54 changes: 27 additions & 27 deletions typescript-declarations/carp-kotlin/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as kotlinStdLib from "@cachet/kotlin-kotlin-stdlib"
import extend from "@cachet/kotlin-kotlin-stdlib"


// Facade with better method names and type conversions for internal types.
Expand All @@ -9,11 +9,11 @@ export namespace kotlin
{
toNumber(): number
}
export const toLong: (number: number) => Long = kotlinStdLib.$_$.toLong_0
export const toLong: (number: number) => Long = extend.$_$.toLong_0
export class Pair<K, V>
{
constructor( first: K, second: V ) {
let kotlinPair = new kotlinStdLib.$_$.Pair( first, second );
let kotlinPair = new extend.$_$.Pair( first, second );
kotlinPair.first = kotlinPair.md_1;
kotlinPair.second = kotlinPair.nd_1;
return kotlinPair;
Expand All @@ -38,12 +38,12 @@ export namespace kotlin.collections
keys: Set<K>
values: Collection<V>
}
export const listOf: <T>(array: T[]) => List<T> = kotlinStdLib.$_$.listOf_0
export const setOf: <T>(array: T[]) => Set<T> = kotlinStdLib.$_$.setOf_0
export const listOf: <T>(array: T[]) => List<T> = extend.$_$.listOf_0
export const setOf: <T>(array: T[]) => Set<T> = extend.$_$.setOf_0
export const mapOf =
function<K, V>( pairs: kotlin.Pair<K, V>[] ): Map<K, V>
{
return kotlinStdLib.$_$.mapOf_0( pairs as any )
return extend.$_$.mapOf_0( pairs as any )
}
}
export namespace kotlin.time
Expand All @@ -55,7 +55,7 @@ export namespace kotlin.time
}
export namespace Duration
{
export const Companion: any = kotlinStdLib.$_$.Companion_getInstance_13()
export const Companion: any = extend.$_$.Companion_getInstance_13()
export const parseIsoString: (isoDuration: string) => Duration = Companion.zf
export const ZERO: Duration = Companion.wf_1
export const INFINITE: Duration = Companion.xf_1
Expand Down Expand Up @@ -97,37 +97,37 @@ declare module "@cachet/kotlin-kotlin-stdlib"


// Implement base interfaces in internal types.
kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.da(); };
Object.defineProperty( kotlinStdLib.$_$.Long.prototype, "inWholeMilliseconds", {
extend.$_$.Long.prototype.toNumber = function(): number { return this.da(); };
Object.defineProperty( extend.$_$.Long.prototype, "inWholeMilliseconds", {
get: function inWholeMilliseconds()
{
return kotlinStdLib.$_$._Duration___get_inWholeMilliseconds__impl__msfiry(this).toNumber();
return extend.$_$._Duration___get_inWholeMilliseconds__impl__msfiry(this).toNumber();
}
} );
Object.defineProperty( kotlinStdLib.$_$.Long.prototype, "inWholeMicroseconds", {
Object.defineProperty( extend.$_$.Long.prototype, "inWholeMicroseconds", {
get: function inWholeMicroseconds()
{
return kotlinStdLib.$_$._Duration___get_inWholeMicroseconds__impl__8oe8vv(this).toNumber();
return extend.$_$._Duration___get_inWholeMicroseconds__impl__8oe8vv(this).toNumber();
}
} );
kotlinStdLib.$_$.EmptyList.prototype.contains = function<T>( value: T ): boolean { return false; }
kotlinStdLib.$_$.EmptyList.prototype.size = function<T>(): number { return 0; }
kotlinStdLib.$_$.EmptyList.prototype.toArray = function<T>(): T[] { return []; }
kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function<T>( value: T ): boolean { return this.p( value ); }
kotlinStdLib.$_$.AbstractMutableList.prototype.size = function<T>(): number { return this.n(); }
kotlinStdLib.$_$.EmptySet.prototype.contains = function<T>( value: T ): boolean { return false; }
kotlinStdLib.$_$.EmptySet.prototype.size = function<T>(): number { return 0; }
kotlinStdLib.$_$.EmptySet.prototype.toArray = function<T>(): T[] { return []; }
kotlinStdLib.$_$.HashSet.prototype.contains = function<T>( value: T ): boolean { return this.p( value ); }
kotlinStdLib.$_$.HashSet.prototype.size = function<T>(): number { return this.n(); }
kotlinStdLib.$_$.HashMap.prototype.get = function<K, V>( key: K ): V { return this.x2( key ); }
Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "keys", {
extend.$_$.EmptyList.prototype.contains = function<T>( value: T ): boolean { return false; }
extend.$_$.EmptyList.prototype.size = function<T>(): number { return 0; }
extend.$_$.EmptyList.prototype.toArray = function<T>(): T[] { return []; }
extend.$_$.AbstractMutableList.prototype.contains = function<T>( value: T ): boolean { return this.p( value ); }
extend.$_$.AbstractMutableList.prototype.size = function<T>(): number { return this.n(); }
extend.$_$.EmptySet.prototype.contains = function<T>( value: T ): boolean { return false; }
extend.$_$.EmptySet.prototype.size = function<T>(): number { return 0; }
extend.$_$.EmptySet.prototype.toArray = function<T>(): T[] { return []; }
extend.$_$.HashSet.prototype.contains = function<T>( value: T ): boolean { return this.p( value ); }
extend.$_$.HashSet.prototype.size = function<T>(): number { return this.n(); }
extend.$_$.HashMap.prototype.get = function<K, V>( key: K ): V { return this.x2( key ); }
Object.defineProperty( extend.$_$.HashMap.prototype, "keys", {
get: function keys() { return this.l2(); }
} );
Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "values", {
Object.defineProperty( extend.$_$.HashMap.prototype, "values", {
get: function values() { return this.m2(); }
} );


// Re-export augmented types.
export * from "@cachet/kotlin-kotlin-stdlib";
// Export facade.
export default kotlin
2 changes: 2 additions & 0 deletions typescript-declarations/carp-kotlin/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-kotlin",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
6 changes: 3 additions & 3 deletions typescript-declarations/carp-kotlinx-datetime/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as extend from "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir"
import extend from "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir"


// Facade with better method names and type conversions for internal types.
Expand Down Expand Up @@ -37,5 +37,5 @@ extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return
extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.y1e(); };


// Re-export augmented types.
export * from "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir"
// Export facade.
export default kotlinx
2 changes: 2 additions & 0 deletions typescript-declarations/carp-kotlinx-datetime/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-kotlinx-datetime",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
8 changes: 4 additions & 4 deletions typescript-declarations/carp-kotlinx-serialization/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as extendCore from "@cachet/kotlinx-serialization-kotlinx-serialization-core"
import * as extendJson from "@cachet/kotlinx-serialization-kotlinx-serialization-json"
import extendCore from "@cachet/kotlinx-serialization-kotlinx-serialization-core"
import extendJson from "@cachet/kotlinx-serialization-kotlinx-serialization-json"


// Facade with better method names and type conversions for internal types.
Expand Down Expand Up @@ -51,5 +51,5 @@ extendJson.$_$.JsonImpl.prototype.decodeFromString =
};


// Re-export augmented types.
export * from "@cachet/kotlinx-serialization-kotlinx-serialization-json"
// Export facade.
export default kotlinx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-kotlinx-serialization",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
28 changes: 14 additions & 14 deletions typescript-declarations/carp-protocols-core/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as extend from "@cachet/carp-protocols-core-generated"
import * as kotlinStdLib from "@cachet/carp-kotlin"
import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization"
import * as carpCommon from "@cachet/carp-common"
import extend from "@cachet/carp-protocols-core-generated"
import kotlinStdLib from "@cachet/carp-kotlin"
import kotlinDateTime from "@cachet/carp-kotlinx-datetime"
import kotlinSerialization from "@cachet/carp-kotlinx-serialization"
import carpCommon from "@cachet/carp-common"


declare module "@cachet/carp-protocols-core-generated"
{
// Declare missing types for which no imports were generated.
namespace kotlin
{
type Long = kotlinStdLib.kotlin.Long
type Long = kotlinStdLib.Long
}
namespace kotlin.reflect
{
Expand All @@ -20,21 +20,21 @@ declare module "@cachet/carp-protocols-core-generated"
}
namespace kotlin.time
{
type Duration = kotlinStdLib.kotlin.time.Duration
type Duration = kotlinStdLib.time.Duration
}
namespace kotlin.collections
{
type List<T> = kotlinStdLib.kotlin.collections.List<T>
type Set<T> = kotlinStdLib.kotlin.collections.Set<T>
type Map<K, V> = kotlinStdLib.kotlin.collections.Map<K, V>
type List<T> = kotlinStdLib.collections.List<T>
type Set<T> = kotlinStdLib.collections.Set<T>
type Map<K, V> = kotlinStdLib.collections.Map<K, V>
}
namespace kotlinx.datetime
{
type Instant = kotlinDateTime.kotlinx.datetime.Instant
type Instant = kotlinDateTime.datetime.Instant
}
namespace kotlinx.serialization.json
{
type Json = kotlinSerialization.kotlinx.serialization.json.Json
type Json = kotlinSerialization.serialization.json.Json
}
}

Expand All @@ -43,5 +43,5 @@ declare module "@cachet/carp-protocols-core-generated"
extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any;


// Export facade.
export * from "@cachet/carp-protocols-core-generated"
// Re-export augmented types.
export { default } from "@cachet/carp-protocols-core-generated"
2 changes: 2 additions & 0 deletions typescript-declarations/carp-protocols-core/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@cachet/carp-protocols-core",
"type": "module",
"main": "index.js",
"version": "1.1.2"
}
Loading

0 comments on commit 9921f04

Please sign in to comment.