Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 0 additions & 25 deletions .eslintrc.cjs

This file was deleted.

34 changes: 34 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig } from 'eslint/config';
import { configs } from '@croct/eslint-plugin';

export default defineConfig(
configs.typescript,
{
ignores: [
'build/**',
'node_modules/**',
'src/infrastructure/graphql/schema',
'test/application/project/code/transformation/fixtures',
],
},
{
rules: {
'import/extensions': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'import-x/extensions': 'off',
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/no-floating-promises': 'off',
},
},
{
files: ['tsup.config.ts'],
rules: {
'import/no-default-export': 'off',
},
}
);
7,144 changes: 4,595 additions & 2,549 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@babel/plugin-syntax-decorators": "^7.27.1",
"@babel/plugin-transform-typescript": "^7.28.5",
"@babel/types": "^7.28.5",
"@commander-js/extra-typings": "^12.1.0",
"@croct/cache": "^0.5.1",
"@croct/content": "^1.1.0",
"@croct/content-model": "^0.21.4",
Expand All @@ -47,6 +48,7 @@
"@croct/logging": "^0.2.3",
"@croct/md-lite": "^0.3.1",
"@croct/sdk": "^0.20.0",
"@croct/time": "^0.10.2",
"@jsep-plugin/object": "^1.2.2",
"@jsep-plugin/regex": "^1.0.4",
"@jsep-plugin/spread": "^1.0.3",
Expand All @@ -73,21 +75,20 @@
"strip-ansi": "^7.1.2",
"terminal-link": "^3.0.0",
"xdg-app-paths": "^8.3.0",
"zod": "^3.25.76",
"@croct/time": "^0.10.2",
"@commander-js/extra-typings": "^12.1.0"
"zod": "^3.25.76"
},
"devDependencies": {
"@croct/eslint-plugin": "^0.7.1",
"@croct/eslint-plugin": "^0.8.3",
"@graphql-codegen/cli": "^5.0.7",
"@swc/jest": "^0.2.39",
"@types/ini": "^4.1.1",
"@types/jest": "^29.5.14",
"@types/prompts": "^2.4.9",
"@types/semver": "^7.7.1",
"@types/tar-stream": "^3.1.4",
"@typescript-eslint/parser": "^6.21.0",
"@typescript-eslint/parser": "^8.54.0",
"esbuild-plugin-file-path-extensions": "^2.1.4",
"eslint": "^8.57.1",
"eslint": "^9.39.2",
"jest": "^29.7.0",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
Expand Down
4 changes: 2 additions & 2 deletions src/application/api/application.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ApiKey} from '@/application/model/application';
import {ApplicationPath} from '@/application/api/workspace';
import type {ApiKey} from '@/application/model/application';
import type {ApplicationPath} from '@/application/api/workspace';

export type NewApiKey = ApplicationPath & Omit<ApiKey, 'id'>;

Expand Down
3 changes: 2 additions & 1 deletion src/application/api/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Help, HelpfulError} from '@/application/error';
import type {Help} from '@/application/error';
import {HelpfulError} from '@/application/error';

export enum AccessDeniedReason {
INTERNAL_ERROR = 'INTERNAL_ERROR',
Expand Down
4 changes: 2 additions & 2 deletions src/application/api/organization.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Workspace} from '@/application/model/workspace';
import type {Workspace} from '@/application/model/workspace';

export type OrganizationPath = {
organizationSlug: string,
Expand All @@ -13,7 +13,7 @@ export type NewWorkspace = OrganizationPath & Omit<Workspace, 'id' | 'slug' | 'l
export interface OrganizationApi {
getWorkspaces(path: OrganizationPath): Promise<Workspace[]>;

getWorkspace(path: WorkspacePath): Promise<Workspace|null>;
getWorkspace(path: WorkspacePath): Promise<Workspace | null>;

createWorkspace(workspace: NewWorkspace): Promise<Workspace>;
}
4 changes: 2 additions & 2 deletions src/application/api/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {User} from '@/application/model/user';
import {Organization} from '@/application/model/organization';
import type {User} from '@/application/model/user';
import type {Organization} from '@/application/model/organization';

export type OrganizationSetup = {
website: string,
Expand Down
30 changes: 15 additions & 15 deletions src/application/api/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {RootDefinition} from '@croct/content-model/definition/definition';
import {WorkspacePath} from '@/application/api/organization';
import {Application} from '@/application/model/application';
import {Audience} from '@/application/model/audience';
import {Slot} from '@/application/model/slot';
import {Component} from '@/application/model/component';
import {
import type {RootDefinition} from '@croct/content-model/definition/definition';
import type {WorkspacePath} from '@/application/api/organization';
import type {Application} from '@/application/model/application';
import type {Audience} from '@/application/model/audience';
import type {Slot} from '@/application/model/slot';
import type {Component} from '@/application/model/component';
import type {
ExperienceDetails,
ExperienceStatus,
Experience,
Expand All @@ -13,7 +13,7 @@ import {
SlotContentMap,
SegmentedContent,
} from '@/application/model/experience';
import {WorkspaceFeatures} from '@/application/model/workspace';
import type {WorkspaceFeatures} from '@/application/model/workspace';

export type AudiencePath = WorkspacePath & {
audienceSlug: string,
Expand Down Expand Up @@ -61,7 +61,7 @@ export type ExperiencePath = WorkspacePath & {
};

export type ExperienceCriteria = WorkspacePath & {
status?: ExperienceStatus|ExperienceStatus[],
status?: ExperienceStatus | ExperienceStatus[],
};

export type SegmentedContentDefinition = Omit<SegmentedContent, 'id'>;
Expand Down Expand Up @@ -125,33 +125,33 @@ export type NewResourceIds = {
};

export interface WorkspaceApi {
getFeatures(path: WorkspacePath): Promise<WorkspaceFeatures|null>;
getFeatures(path: WorkspacePath): Promise<WorkspaceFeatures | null>;

getAudiences(path: WorkspacePath): Promise<Audience[]>;

getAudience(path: AudiencePath): Promise<Audience|null>;
getAudience(path: AudiencePath): Promise<Audience | null>;

getSlots(path: WorkspacePath): Promise<Slot[]>;

getSlot(criteria: SlotCriteria): Promise<Slot|null>;
getSlot(criteria: SlotCriteria): Promise<Slot | null>;

getComponents(path: WorkspacePath): Promise<Component[]>;

getComponent(criteria: ComponentCriteria): Promise<Component|null>;
getComponent(criteria: ComponentCriteria): Promise<Component | null>;

getSlotStaticContent(path: SlotPath, majorVersion?: number): Promise<LocalizedContent[]>;

generateTypes(typing: TargetTyping): Promise<string>;

getApplications(path: WorkspacePath): Promise<Application[]>;

getApplication(path: ApplicationPath): Promise<Application|null>;
getApplication(path: ApplicationPath): Promise<Application | null>;

createApplication(application: NewApplication): Promise<Application>;

getExperiences(path: ExperienceCriteria): Promise<Experience[]>;

getExperience(path: ExperiencePath): Promise<ExperienceDetails|null>;
getExperience(path: ExperiencePath): Promise<ExperienceDetails | null>;

createResources(resources: NewResources): Promise<NewResourceIds>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {ApiKey} from '@croct/sdk/apiKey';
import type {ApiKey} from '@croct/sdk/apiKey';
import {Token} from '@croct/sdk/token';
import {Clock, Instant} from '@croct/time';
import {Authenticator} from '@/application/cli/authentication/authenticator/index';
import type {Clock} from '@croct/time';
import {Instant} from '@croct/time';
import type {Authenticator} from '@/application/cli/authentication/authenticator/index';

export type Configuration = {
apiKey: ApiKey,
Expand All @@ -24,7 +25,7 @@ export class ApiKeyAuthenticator implements Authenticator<Record<never, never>>
this.tokenDuration = tokenDuration;
}

public getToken(): Promise<string|null> {
public getToken(): Promise<string | null> {
return Promise.resolve(this.token?.toString() ?? null);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Help, HelpfulError} from '@/application/error';
import type {Help} from '@/application/error';
import {HelpfulError} from '@/application/error';

export interface TokenProvider {
getToken(): Promise<string | null>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import {CacheProvider} from '@croct/cache';
import type {CacheProvider} from '@croct/cache';
import {deepEqual} from 'fast-equals';
import {AuthenticationInput, Authenticator} from '@/application/cli/authentication/authenticator/index';
import type {AuthenticationInput, Authenticator} from '@/application/cli/authentication/authenticator/index';

export type Configuration<I extends AuthenticationInput>= {
export type Configuration<I extends AuthenticationInput> = {
authenticator: Authenticator<I>,
cacheKey: string,
cacheProvider: CacheProvider<string, string|null>,
cacheProvider: CacheProvider<string, string | null>,
};

export class CachedAuthenticator<I extends AuthenticationInput> implements Authenticator<I> {
private readonly authenticator: Authenticator<I>;

private readonly cacheKey: string;

private readonly tokenCache: CacheProvider<string, string|null>;
private readonly tokenCache: CacheProvider<string, string | null>;

private readonly inFlightCache: Map<I, Promise<string>> = new Map();

Expand All @@ -23,7 +23,7 @@ export class CachedAuthenticator<I extends AuthenticationInput> implements Authe
this.tokenCache = cacheProvider;
}

public getToken(): Promise<string|null> {
public getToken(): Promise<string | null> {
return this.tokenCache.get(this.cacheKey, () => this.authenticator.getToken());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Input} from '@/application/cli/io/input';
import {Output} from '@/application/cli/io/output';
import {UserApi} from '@/application/api/user';
import {Authenticator} from '@/application/cli/authentication/authenticator/index';
import {Form} from '@/application/cli/form/form';
import {SignInOptions} from '@/application/cli/form/user/signInForm';
import {SignUpOptions} from '@/application/cli/form/user/signUpForm';
import type {Input} from '@/application/cli/io/input';
import type {Output} from '@/application/cli/io/output';
import type {UserApi} from '@/application/api/user';
import type {Authenticator} from '@/application/cli/authentication/authenticator/index';
import type {Form} from '@/application/cli/form/form';
import type {SignInOptions} from '@/application/cli/form/user/signInForm';
import type {SignUpOptions} from '@/application/cli/form/user/signUpForm';
import {EmailInput} from '@/application/cli/form/input/emailInput';

export type Configuration = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {AuthenticationInput, Authenticator} from '@/application/cli/authentication/authenticator/index';
import {Form} from '@/application/cli/form/form';
import {InvitationOptions} from '@/application/cli/form/user/invitationForm';
import type {AuthenticationInput, Authenticator} from '@/application/cli/authentication/authenticator/index';
import type {Form} from '@/application/cli/form/form';
import type {InvitationOptions} from '@/application/cli/form/user/invitationForm';

export type Configuration<T extends AuthenticationInput> = {
authenticator: Authenticator<T>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Authenticator} from '@/application/cli/authentication/authenticator/authenticator';
import type {Authenticator} from '@/application/cli/authentication/authenticator/authenticator';

type AuthenticationInputs = Record<string, Record<string, any>>;

Expand All @@ -19,7 +19,7 @@ export class MultiAuthenticator<T extends AuthenticationInputs> implements Authe
this.authenticators = authenticators;
}

public async getToken(): Promise<string|null> {
public async getToken(): Promise<string | null> {
for (const authenticator of Object.values(this.authenticators)) {
const token = await authenticator.getToken();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {AuthenticationInput, Authenticator} from '@/application/cli/authentication/authenticator/index';
import type {AuthenticationInput, Authenticator} from '@/application/cli/authentication/authenticator/index';

import {HelpfulError, Help} from '@/application/error';
import type {Help} from '@/application/error';
import {HelpfulError} from '@/application/error';

export type Instruction = Help & {
message: string,
Expand All @@ -21,7 +22,7 @@ export class NonInteractiveAuthenticator<T extends AuthenticationInput> implemen
this.authenticator = authenticator;
}

public getToken(): Promise<string|null> {
public getToken(): Promise<string | null> {
return this.authenticator.getToken();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Token} from '@croct/sdk/token';
import {Authenticator} from '@/application/cli/authentication/authenticator/index';
import type {Token} from '@croct/sdk/token';
import type {Authenticator} from '@/application/cli/authentication/authenticator/index';
import {ErrorReason, HelpfulError} from '@/application/error';

export type Configuration = {
Expand All @@ -13,7 +13,7 @@ export class ProvidedTokenAuthenticator implements Authenticator<Record<never, n
this.token = token;
}

public getToken(): Promise<string|null> {
public getToken(): Promise<string | null> {
return Promise.resolve(this.token.toString());
}

Expand Down
10 changes: 5 additions & 5 deletions src/application/cli/autoUpdater.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import semver from 'semver';
import isInstalledGlobally from 'is-installed-globally';
import {PackageManager} from '@/application/project/packageManager/packageManager';
import {Output} from '@/application/cli/io/output';
import {Input} from '@/application/cli/io/input';
import {CliConfiguration, CliConfigurationProvider} from '@/application/cli/configuration/provider';
import type {PackageManager} from '@/application/project/packageManager/packageManager';
import type {Output} from '@/application/cli/io/output';
import type {Input} from '@/application/cli/io/input';
import type {CliConfiguration, CliConfigurationProvider} from '@/application/cli/configuration/provider';
import {TaskProgressLogger} from '@/infrastructure/application/cli/io/taskProgressLogger';

export type Configuration = {
Expand Down Expand Up @@ -88,7 +88,7 @@ export class AutoUpdater {
notifier: notifier,
}),
});
} catch (error) {
} catch {
const updateCommand = await this.packageManager.getPackageUpdateCommand('croct', {
global: isInstalledGlobally,
});
Expand Down
12 changes: 6 additions & 6 deletions src/application/cli/command/admin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Command} from '@/application/cli/command/command';
import {Output} from '@/application/cli/io/output';
import {UserApi} from '@/application/api/user';
import {PageOptions} from '@/application/cli/form/page';
import {Form} from '@/application/cli/form/form';
import {ConfigurationManager} from '@/application/project/configuration/manager/configurationManager';
import type {Command} from '@/application/cli/command/command';
import type {Output} from '@/application/cli/io/output';
import type {UserApi} from '@/application/api/user';
import type {PageOptions} from '@/application/cli/form/page';
import type {Form} from '@/application/cli/form/form';
import type {ConfigurationManager} from '@/application/project/configuration/manager/configurationManager';

export type AdminInput = {
page?: string,
Expand Down
Loading
Loading