Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"sinon": "^14.0.0",
"sinon-chai": "^3.7.0",
"source-map-loader": "^4.0.0",
"typescript": "~4.7.4",
"typescript": "~4.8.2",
"util": "^0.12.4",
"webpack": "^5.74.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/com/communication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class Communication {
/**
* Creates a Proxy for a remote service api.
*/
public apiProxy<T>(
public apiProxy<T extends object>(
instanceToken: EnvironmentInstanceToken | Promise<EnvironmentInstanceToken>,
{ id: api }: IDTag,
serviceComConfig: ServiceComConfig<T> = {}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/com/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface EnvironmentRecord {

export type UnknownFunction = (...args: unknown[]) => unknown;

export type AsyncApi<T> = {
export type AsyncApi<T extends object> = {
[P in keyof T]: P extends keyof ServiceConfig<T>
? MultiTanentProxyFunction<T, P extends string ? P : never>
: T[P] extends (...args: any[]) => PromiseLike<any>
Expand Down
10 changes: 7 additions & 3 deletions packages/core/src/entities/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import type { EnvVisibility } from '../types';
import { AllEnvironments, Environment, normEnvVisibility, Universal } from './env';
import { FeatureOutput } from './output';

export type ServiceRuntime<T, ProvidedFrom> = ProvidedFrom extends Environment<string, EnvironmentTypes, 'single'>
export type ServiceRuntime<T extends object, ProvidedFrom> = ProvidedFrom extends Environment<
string,
EnvironmentTypes,
'single'
>
? AsyncApi<T>
: ProvidedFrom extends Environment<string, EnvironmentTypes, 'multi', any>
? {
Expand All @@ -15,13 +19,13 @@ export type ServiceRuntime<T, ProvidedFrom> = ProvidedFrom extends Environment<s
: AsyncApi<T>;

export class Service<
T,
T extends object,
PT,
ProvidedFrom extends EnvVisibility,
VisibleAt extends EnvVisibility,
RemoteAccess extends boolean
> extends FeatureOutput<T, PT, ProvidedFrom, VisibleAt, RemoteAccess> {
public static withType<T>() {
public static withType<T extends object>() {
return {
defineEntity<E_ENV extends EnvVisibility>(providedFrom: E_ENV) {
return new Service<T, T, E_ENV, E_ENV, false>(providedFrom, providedFrom, false);
Expand Down
5 changes: 3 additions & 2 deletions packages/engineer/src/cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import fs from '@file-services/node';
import { Application } from '@wixc3/engine-scripts';
import { startDevServer } from './utils';
import { parseCliArguments } from '@wixc3/engine-runtime-node';
import type { ServerListeningHandler } from './feature/dev-server.feature';

const parseBoolean = (value: string) => value === 'true';
const collectMultiple = (val: string, prev: string[]) => [...prev, val];
Expand Down Expand Up @@ -123,12 +124,12 @@ export const startCommand: CliCommand = (program) =>
log,
});

const { port } = await new Promise((resolve) => {
const { port } = await new Promise((resolve: ServerListeningHandler) => {
devServerFeature.serverListeningHandlerSlot.register(resolve);
});

if (!process.send && featureName && configName && openBrowser === 'true') {
await open(`http://localhost:${port as string}/main.html`);
await open(`http://localhost:${port}/main.html`);
}
} catch (e) {
printErrorAndExit(e);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
// "skipLibCheck": true, /* Skip type checking of declaration files. */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7954,10 +7954,10 @@ typescript-type-utils@^0.1.0:
resolved "https://registry.yarnpkg.com/typescript-type-utils/-/typescript-type-utils-0.1.0.tgz#8ea40e5ceb41297184d36a2ef928932ad0f1e407"
integrity sha512-UXvYaUWfkUuTf287zYi+AE9pRkdHVcDHXk1N02a/ZmonLH2xpJL8EGzNozT/HNkAF+POlR6Lcx1wgg0ljMLcrw==

typescript@~4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==
typescript@~4.8.2:
version "4.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790"
integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==

uglify-js@^3.1.4:
version "3.17.0"
Expand Down