@elek-io/core 0.1.1 → 0.2.0
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/dist/index.cjs +265 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -47
- package/dist/index.d.ts +99 -47
- package/dist/index.js +286 -167
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _elek_io_shared from '@elek-io/shared';
|
|
2
|
-
import { ServiceType, ElekIoCoreOptions, BaseFile, GitTag, Sort, PaginatedList,
|
|
2
|
+
import { ServiceType, ElekIoCoreOptions, BaseFile, GitTag, Sort, PaginatedList, ObjectType, FileReference, ExtendedCrudService, CreateGitTagProps, ReadGitTagProps, DeleteGitTagProps, ListGitTagsProps, CountGitTagsProps, UserFile, User, SetUserProps, GitInitOptions, GitCloneOptions, GitSwitchOptions, GitLogOptions, GitCommit, Asset, CreateAssetProps, ReadAssetProps, UpdateAssetProps, DeleteAssetProps, ListAssetsProps, CountAssetsProps, Collection, CreateCollectionProps, ReadCollectionProps, UpdateCollectionProps, DeleteCollectionProps, ListCollectionsProps, CountCollectionsProps, SharedValue, CreateSharedValueProps, ReadSharedValueProps, UpdateSharedValueProps, DeleteSharedValueProps, ListSharedValuesProps, CountValuesProps, Entry, CreateEntryProps, ReadEntryProps, UpdateEntryProps, DeleteEntryProps, ListEntriesProps, CountEntriesProps, Project, CreateProjectProps, ReadProjectProps, UpdateProjectProps, UpgradeProjectProps, DeleteProjectProps, ListProjectsProps, ProjectExport, ConstructorElekIoCoreProps } from '@elek-io/shared';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
5
5
|
import Fs from 'fs-extra';
|
|
@@ -46,7 +46,7 @@ declare abstract class AbstractCrudService {
|
|
|
46
46
|
* @param projectId Project to get all asset references from
|
|
47
47
|
* @param collectionId Only needed when requesting files of type "Entry"
|
|
48
48
|
*/
|
|
49
|
-
protected listReferences(type:
|
|
49
|
+
protected listReferences(type: ObjectType, projectId?: string, collectionId?: string): Promise<FileReference[]>;
|
|
50
50
|
private getFolderReferences;
|
|
51
51
|
/**
|
|
52
52
|
* Searches for all files inside given folder,
|
|
@@ -460,38 +460,40 @@ declare class CollectionService extends AbstractCrudService implements ExtendedC
|
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
/**
|
|
463
|
-
* Service that manages CRUD functionality for Value files on disk
|
|
463
|
+
* Service that manages CRUD functionality for shared Value files on disk
|
|
464
464
|
*/
|
|
465
|
-
declare class
|
|
465
|
+
declare class SharedValueService extends AbstractCrudService implements ExtendedCrudService<SharedValue> {
|
|
466
466
|
private jsonFileService;
|
|
467
467
|
private gitService;
|
|
468
468
|
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, assetService: AssetService);
|
|
469
469
|
/**
|
|
470
|
-
* Creates a new Value
|
|
470
|
+
* Creates a new shared Value
|
|
471
471
|
*/
|
|
472
|
-
create(props:
|
|
472
|
+
create(props: CreateSharedValueProps): Promise<SharedValue>;
|
|
473
473
|
/**
|
|
474
|
-
* Returns a Value by ID and language
|
|
474
|
+
* Returns a shared Value by ID and language
|
|
475
475
|
*/
|
|
476
|
-
read(props:
|
|
476
|
+
read(props: ReadSharedValueProps): Promise<SharedValue>;
|
|
477
477
|
/**
|
|
478
|
-
* Updates given
|
|
478
|
+
* Updates given shared Values content
|
|
479
|
+
*
|
|
480
|
+
* The valueType cannot be changed after creating the shared Value
|
|
479
481
|
*/
|
|
480
|
-
update(props:
|
|
482
|
+
update(props: UpdateSharedValueProps): Promise<SharedValue>;
|
|
481
483
|
/**
|
|
482
|
-
* Deletes given Value
|
|
484
|
+
* Deletes given shared Value
|
|
483
485
|
*/
|
|
484
|
-
delete(props:
|
|
485
|
-
list(props:
|
|
486
|
+
delete(props: DeleteSharedValueProps): Promise<void>;
|
|
487
|
+
list(props: ListSharedValuesProps): Promise<PaginatedList<SharedValue>>;
|
|
486
488
|
count(props: CountValuesProps): Promise<number>;
|
|
487
489
|
/**
|
|
488
|
-
* Checks if given object is
|
|
490
|
+
* Checks if given object is a shared Value
|
|
489
491
|
*/
|
|
490
|
-
|
|
492
|
+
isSharedValue(obj: BaseFile | unknown): obj is SharedValue;
|
|
491
493
|
/**
|
|
492
|
-
* Reads the given
|
|
494
|
+
* Reads the given shared Values content based on it's ValueType
|
|
493
495
|
*/
|
|
494
|
-
validate
|
|
496
|
+
private validate;
|
|
495
497
|
}
|
|
496
498
|
|
|
497
499
|
/**
|
|
@@ -501,50 +503,100 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
501
503
|
private jsonFileService;
|
|
502
504
|
private gitService;
|
|
503
505
|
private collectionService;
|
|
504
|
-
private
|
|
505
|
-
|
|
506
|
+
private assetService;
|
|
507
|
+
private sharedValueService;
|
|
508
|
+
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, collectionService: CollectionService, assetService: AssetService, sharedValueService: SharedValueService);
|
|
506
509
|
/**
|
|
507
|
-
* Creates a new Entry
|
|
510
|
+
* Creates a new Entry for given Collection
|
|
508
511
|
*/
|
|
509
512
|
create(props: CreateEntryProps): Promise<Entry>;
|
|
510
513
|
/**
|
|
511
|
-
* Returns an Entry by ID and language
|
|
514
|
+
* Returns an Entry from given Collection by ID and language
|
|
512
515
|
*/
|
|
513
516
|
read(props: ReadEntryProps): Promise<Entry>;
|
|
514
517
|
/**
|
|
515
|
-
* Updates Entry
|
|
518
|
+
* Updates an Entry of given Collection with new Values and shared Values
|
|
516
519
|
*/
|
|
517
520
|
update(props: UpdateEntryProps): Promise<Entry>;
|
|
518
521
|
/**
|
|
519
|
-
* Deletes given Entry
|
|
522
|
+
* Deletes given Entry from it's Collection
|
|
520
523
|
*/
|
|
521
524
|
delete(props: DeleteEntryProps): Promise<void>;
|
|
522
525
|
list(props: ListEntriesProps): Promise<_elek_io_shared.PaginatedList<{
|
|
526
|
+
values: ({
|
|
527
|
+
objectType: "value";
|
|
528
|
+
valueType: "string" | "number" | "boolean";
|
|
529
|
+
definitionId: string;
|
|
530
|
+
content?: string | number | boolean | undefined;
|
|
531
|
+
} | {
|
|
532
|
+
objectType: "value";
|
|
533
|
+
valueType: "reference";
|
|
534
|
+
content: {
|
|
535
|
+
referenceObjectType: "asset";
|
|
536
|
+
references: {
|
|
537
|
+
id: string;
|
|
538
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
539
|
+
resolved: {
|
|
540
|
+
extension: "avif" | "gif" | "jpg" | "jpeg" | "png" | "svg" | "webp" | "pdf" | "zip" | "mp4" | "webm" | "flac" | "json";
|
|
541
|
+
mimeType: "image/avif" | "image/gif" | "image/jpeg" | "image/png" | "image/svg+xml" | "image/webp" | "application/pdf" | "application/zip" | "video/mp4" | "video/webm" | "audio/webm" | "audio/flac";
|
|
542
|
+
id: string;
|
|
543
|
+
name: string;
|
|
544
|
+
objectType: "asset";
|
|
545
|
+
created: number;
|
|
546
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
547
|
+
description: string;
|
|
548
|
+
size: number;
|
|
549
|
+
absolutePath: string;
|
|
550
|
+
updated?: number | undefined;
|
|
551
|
+
};
|
|
552
|
+
}[];
|
|
553
|
+
} | {
|
|
554
|
+
referenceObjectType: "sharedValue";
|
|
555
|
+
references: {
|
|
556
|
+
id: string;
|
|
557
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
558
|
+
resolved: {
|
|
559
|
+
id: string;
|
|
560
|
+
objectType: "sharedValue";
|
|
561
|
+
created: number;
|
|
562
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
563
|
+
valueType: "string" | "number" | "boolean";
|
|
564
|
+
updated?: number | undefined;
|
|
565
|
+
content?: string | number | boolean | undefined;
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
definitionId: string;
|
|
570
|
+
})[];
|
|
523
571
|
id: string;
|
|
524
|
-
|
|
572
|
+
objectType: "entry";
|
|
525
573
|
created: number;
|
|
526
574
|
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
527
|
-
valueReferences: {
|
|
528
|
-
definitionId: string;
|
|
529
|
-
references: {
|
|
530
|
-
id: string;
|
|
531
|
-
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
532
|
-
};
|
|
533
|
-
}[];
|
|
534
575
|
updated?: number | undefined;
|
|
535
576
|
}>>;
|
|
536
577
|
count(props: CountEntriesProps): Promise<number>;
|
|
537
578
|
/**
|
|
538
|
-
* Checks if given object of
|
|
539
|
-
* Field, Project or Asset is of type CollectionItem
|
|
579
|
+
* Checks if given object is of type Entry
|
|
540
580
|
*/
|
|
541
581
|
isEntry(obj: BaseFile | unknown): obj is Entry;
|
|
542
582
|
/**
|
|
543
|
-
*
|
|
544
|
-
|
|
545
|
-
|
|
583
|
+
* Returns a Value definition by ID
|
|
584
|
+
*/
|
|
585
|
+
private getValueDefinitionById;
|
|
586
|
+
/**
|
|
587
|
+
* Validates given Values against it's Collections definitions
|
|
588
|
+
*/
|
|
589
|
+
private validateValues;
|
|
590
|
+
/**
|
|
591
|
+
* Validates given shared Value references against it's Collections definitions
|
|
592
|
+
*/
|
|
593
|
+
private resolveValueContentReference;
|
|
594
|
+
private resolveValueContentReferenceToAsset;
|
|
595
|
+
private resolveValueContentReferenceToSharedValue;
|
|
596
|
+
/**
|
|
597
|
+
* Creates an Entry from given EntryFile by resolving it's Values
|
|
546
598
|
*/
|
|
547
|
-
private
|
|
599
|
+
private toEntry;
|
|
548
600
|
}
|
|
549
601
|
|
|
550
602
|
/**
|
|
@@ -564,8 +616,8 @@ declare class SearchService extends AbstractCrudService {
|
|
|
564
616
|
* @param project Project to search in
|
|
565
617
|
* @param query Query to search for
|
|
566
618
|
*/
|
|
567
|
-
search(projectId: string, query: string,
|
|
568
|
-
type: "value" | "project" | "asset" | "collection" | "entry";
|
|
619
|
+
search(projectId: string, query: string, objectType?: ObjectType): Promise<{
|
|
620
|
+
type: "value" | "project" | "asset" | "collection" | "entry" | "sharedValue";
|
|
569
621
|
id: string;
|
|
570
622
|
name: string;
|
|
571
623
|
matches: {
|
|
@@ -590,8 +642,7 @@ declare class ProjectService extends AbstractCrudService implements ExtendedCrud
|
|
|
590
642
|
private assetService;
|
|
591
643
|
private collectionService;
|
|
592
644
|
private entryService;
|
|
593
|
-
|
|
594
|
-
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, userService: UserService, gitService: GitService, searchService: SearchService, assetService: AssetService, collectionService: CollectionService, entryService: EntryService, valueService: ValueService);
|
|
645
|
+
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, userService: UserService, gitService: GitService, searchService: SearchService, assetService: AssetService, collectionService: CollectionService, entryService: EntryService);
|
|
595
646
|
/**
|
|
596
647
|
* Creates a new Project
|
|
597
648
|
*/
|
|
@@ -629,8 +680,8 @@ declare class ProjectService extends AbstractCrudService implements ExtendedCrud
|
|
|
629
680
|
* @param query Query to search for
|
|
630
681
|
* @param type (Optional) specify the type to search for
|
|
631
682
|
*/
|
|
632
|
-
search(projectId: string, query: string, type?:
|
|
633
|
-
type: "value" | "project" | "asset" | "collection" | "entry";
|
|
683
|
+
search(projectId: string, query: string, type?: ObjectType): Promise<{
|
|
684
|
+
type: "value" | "project" | "asset" | "collection" | "entry" | "sharedValue";
|
|
634
685
|
id: string;
|
|
635
686
|
name: string;
|
|
636
687
|
matches: {
|
|
@@ -648,6 +699,7 @@ declare class ProjectService extends AbstractCrudService implements ExtendedCrud
|
|
|
648
699
|
/**
|
|
649
700
|
* Exports given Project to JSON
|
|
650
701
|
*
|
|
702
|
+
* @todo do not read everything before writing to disk -> stream into file given via props
|
|
651
703
|
* @todo performance tests
|
|
652
704
|
* @todo add progress callback
|
|
653
705
|
*/
|
|
@@ -688,8 +740,8 @@ declare const pathTo: {
|
|
|
688
740
|
collectionFile: (projectId: string, id: string) => string;
|
|
689
741
|
entries: (projectId: string, collectionId: string) => string;
|
|
690
742
|
entryFile: (projectId: string, collectionId: string, id: string, language: string) => string;
|
|
691
|
-
|
|
692
|
-
|
|
743
|
+
sharedValues: (projectId: string) => string;
|
|
744
|
+
sharedValueFile: (projectId: string, id: string, language: string) => string;
|
|
693
745
|
assets: (projectId: string) => string;
|
|
694
746
|
assetFile: (projectId: string, id: string, language: string) => string;
|
|
695
747
|
asset: (projectId: string, id: string, language: string, extension: string) => string;
|
|
@@ -781,7 +833,7 @@ declare class ElekIoCore {
|
|
|
781
833
|
private readonly projectService;
|
|
782
834
|
private readonly collectionService;
|
|
783
835
|
private readonly entryService;
|
|
784
|
-
private readonly
|
|
836
|
+
private readonly sharedValueService;
|
|
785
837
|
constructor(props?: ConstructorElekIoCoreProps);
|
|
786
838
|
/**
|
|
787
839
|
* Utility / helper functions
|
|
@@ -810,7 +862,7 @@ declare class ElekIoCore {
|
|
|
810
862
|
/**
|
|
811
863
|
* CRUD methods to work with Values
|
|
812
864
|
*/
|
|
813
|
-
get
|
|
865
|
+
get sharedValues(): SharedValueService;
|
|
814
866
|
}
|
|
815
867
|
|
|
816
868
|
export { ElekIoCore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _elek_io_shared from '@elek-io/shared';
|
|
2
|
-
import { ServiceType, ElekIoCoreOptions, BaseFile, GitTag, Sort, PaginatedList,
|
|
2
|
+
import { ServiceType, ElekIoCoreOptions, BaseFile, GitTag, Sort, PaginatedList, ObjectType, FileReference, ExtendedCrudService, CreateGitTagProps, ReadGitTagProps, DeleteGitTagProps, ListGitTagsProps, CountGitTagsProps, UserFile, User, SetUserProps, GitInitOptions, GitCloneOptions, GitSwitchOptions, GitLogOptions, GitCommit, Asset, CreateAssetProps, ReadAssetProps, UpdateAssetProps, DeleteAssetProps, ListAssetsProps, CountAssetsProps, Collection, CreateCollectionProps, ReadCollectionProps, UpdateCollectionProps, DeleteCollectionProps, ListCollectionsProps, CountCollectionsProps, SharedValue, CreateSharedValueProps, ReadSharedValueProps, UpdateSharedValueProps, DeleteSharedValueProps, ListSharedValuesProps, CountValuesProps, Entry, CreateEntryProps, ReadEntryProps, UpdateEntryProps, DeleteEntryProps, ListEntriesProps, CountEntriesProps, Project, CreateProjectProps, ReadProjectProps, UpdateProjectProps, UpgradeProjectProps, DeleteProjectProps, ListProjectsProps, ProjectExport, ConstructorElekIoCoreProps } from '@elek-io/shared';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
5
5
|
import Fs from 'fs-extra';
|
|
@@ -46,7 +46,7 @@ declare abstract class AbstractCrudService {
|
|
|
46
46
|
* @param projectId Project to get all asset references from
|
|
47
47
|
* @param collectionId Only needed when requesting files of type "Entry"
|
|
48
48
|
*/
|
|
49
|
-
protected listReferences(type:
|
|
49
|
+
protected listReferences(type: ObjectType, projectId?: string, collectionId?: string): Promise<FileReference[]>;
|
|
50
50
|
private getFolderReferences;
|
|
51
51
|
/**
|
|
52
52
|
* Searches for all files inside given folder,
|
|
@@ -460,38 +460,40 @@ declare class CollectionService extends AbstractCrudService implements ExtendedC
|
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
/**
|
|
463
|
-
* Service that manages CRUD functionality for Value files on disk
|
|
463
|
+
* Service that manages CRUD functionality for shared Value files on disk
|
|
464
464
|
*/
|
|
465
|
-
declare class
|
|
465
|
+
declare class SharedValueService extends AbstractCrudService implements ExtendedCrudService<SharedValue> {
|
|
466
466
|
private jsonFileService;
|
|
467
467
|
private gitService;
|
|
468
468
|
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, assetService: AssetService);
|
|
469
469
|
/**
|
|
470
|
-
* Creates a new Value
|
|
470
|
+
* Creates a new shared Value
|
|
471
471
|
*/
|
|
472
|
-
create(props:
|
|
472
|
+
create(props: CreateSharedValueProps): Promise<SharedValue>;
|
|
473
473
|
/**
|
|
474
|
-
* Returns a Value by ID and language
|
|
474
|
+
* Returns a shared Value by ID and language
|
|
475
475
|
*/
|
|
476
|
-
read(props:
|
|
476
|
+
read(props: ReadSharedValueProps): Promise<SharedValue>;
|
|
477
477
|
/**
|
|
478
|
-
* Updates given
|
|
478
|
+
* Updates given shared Values content
|
|
479
|
+
*
|
|
480
|
+
* The valueType cannot be changed after creating the shared Value
|
|
479
481
|
*/
|
|
480
|
-
update(props:
|
|
482
|
+
update(props: UpdateSharedValueProps): Promise<SharedValue>;
|
|
481
483
|
/**
|
|
482
|
-
* Deletes given Value
|
|
484
|
+
* Deletes given shared Value
|
|
483
485
|
*/
|
|
484
|
-
delete(props:
|
|
485
|
-
list(props:
|
|
486
|
+
delete(props: DeleteSharedValueProps): Promise<void>;
|
|
487
|
+
list(props: ListSharedValuesProps): Promise<PaginatedList<SharedValue>>;
|
|
486
488
|
count(props: CountValuesProps): Promise<number>;
|
|
487
489
|
/**
|
|
488
|
-
* Checks if given object is
|
|
490
|
+
* Checks if given object is a shared Value
|
|
489
491
|
*/
|
|
490
|
-
|
|
492
|
+
isSharedValue(obj: BaseFile | unknown): obj is SharedValue;
|
|
491
493
|
/**
|
|
492
|
-
* Reads the given
|
|
494
|
+
* Reads the given shared Values content based on it's ValueType
|
|
493
495
|
*/
|
|
494
|
-
validate
|
|
496
|
+
private validate;
|
|
495
497
|
}
|
|
496
498
|
|
|
497
499
|
/**
|
|
@@ -501,50 +503,100 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
501
503
|
private jsonFileService;
|
|
502
504
|
private gitService;
|
|
503
505
|
private collectionService;
|
|
504
|
-
private
|
|
505
|
-
|
|
506
|
+
private assetService;
|
|
507
|
+
private sharedValueService;
|
|
508
|
+
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, collectionService: CollectionService, assetService: AssetService, sharedValueService: SharedValueService);
|
|
506
509
|
/**
|
|
507
|
-
* Creates a new Entry
|
|
510
|
+
* Creates a new Entry for given Collection
|
|
508
511
|
*/
|
|
509
512
|
create(props: CreateEntryProps): Promise<Entry>;
|
|
510
513
|
/**
|
|
511
|
-
* Returns an Entry by ID and language
|
|
514
|
+
* Returns an Entry from given Collection by ID and language
|
|
512
515
|
*/
|
|
513
516
|
read(props: ReadEntryProps): Promise<Entry>;
|
|
514
517
|
/**
|
|
515
|
-
* Updates Entry
|
|
518
|
+
* Updates an Entry of given Collection with new Values and shared Values
|
|
516
519
|
*/
|
|
517
520
|
update(props: UpdateEntryProps): Promise<Entry>;
|
|
518
521
|
/**
|
|
519
|
-
* Deletes given Entry
|
|
522
|
+
* Deletes given Entry from it's Collection
|
|
520
523
|
*/
|
|
521
524
|
delete(props: DeleteEntryProps): Promise<void>;
|
|
522
525
|
list(props: ListEntriesProps): Promise<_elek_io_shared.PaginatedList<{
|
|
526
|
+
values: ({
|
|
527
|
+
objectType: "value";
|
|
528
|
+
valueType: "string" | "number" | "boolean";
|
|
529
|
+
definitionId: string;
|
|
530
|
+
content?: string | number | boolean | undefined;
|
|
531
|
+
} | {
|
|
532
|
+
objectType: "value";
|
|
533
|
+
valueType: "reference";
|
|
534
|
+
content: {
|
|
535
|
+
referenceObjectType: "asset";
|
|
536
|
+
references: {
|
|
537
|
+
id: string;
|
|
538
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
539
|
+
resolved: {
|
|
540
|
+
extension: "avif" | "gif" | "jpg" | "jpeg" | "png" | "svg" | "webp" | "pdf" | "zip" | "mp4" | "webm" | "flac" | "json";
|
|
541
|
+
mimeType: "image/avif" | "image/gif" | "image/jpeg" | "image/png" | "image/svg+xml" | "image/webp" | "application/pdf" | "application/zip" | "video/mp4" | "video/webm" | "audio/webm" | "audio/flac";
|
|
542
|
+
id: string;
|
|
543
|
+
name: string;
|
|
544
|
+
objectType: "asset";
|
|
545
|
+
created: number;
|
|
546
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
547
|
+
description: string;
|
|
548
|
+
size: number;
|
|
549
|
+
absolutePath: string;
|
|
550
|
+
updated?: number | undefined;
|
|
551
|
+
};
|
|
552
|
+
}[];
|
|
553
|
+
} | {
|
|
554
|
+
referenceObjectType: "sharedValue";
|
|
555
|
+
references: {
|
|
556
|
+
id: string;
|
|
557
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
558
|
+
resolved: {
|
|
559
|
+
id: string;
|
|
560
|
+
objectType: "sharedValue";
|
|
561
|
+
created: number;
|
|
562
|
+
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
563
|
+
valueType: "string" | "number" | "boolean";
|
|
564
|
+
updated?: number | undefined;
|
|
565
|
+
content?: string | number | boolean | undefined;
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
definitionId: string;
|
|
570
|
+
})[];
|
|
523
571
|
id: string;
|
|
524
|
-
|
|
572
|
+
objectType: "entry";
|
|
525
573
|
created: number;
|
|
526
574
|
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
527
|
-
valueReferences: {
|
|
528
|
-
definitionId: string;
|
|
529
|
-
references: {
|
|
530
|
-
id: string;
|
|
531
|
-
language: "bg" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "lt" | "lv" | "nl" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "zh";
|
|
532
|
-
};
|
|
533
|
-
}[];
|
|
534
575
|
updated?: number | undefined;
|
|
535
576
|
}>>;
|
|
536
577
|
count(props: CountEntriesProps): Promise<number>;
|
|
537
578
|
/**
|
|
538
|
-
* Checks if given object of
|
|
539
|
-
* Field, Project or Asset is of type CollectionItem
|
|
579
|
+
* Checks if given object is of type Entry
|
|
540
580
|
*/
|
|
541
581
|
isEntry(obj: BaseFile | unknown): obj is Entry;
|
|
542
582
|
/**
|
|
543
|
-
*
|
|
544
|
-
|
|
545
|
-
|
|
583
|
+
* Returns a Value definition by ID
|
|
584
|
+
*/
|
|
585
|
+
private getValueDefinitionById;
|
|
586
|
+
/**
|
|
587
|
+
* Validates given Values against it's Collections definitions
|
|
588
|
+
*/
|
|
589
|
+
private validateValues;
|
|
590
|
+
/**
|
|
591
|
+
* Validates given shared Value references against it's Collections definitions
|
|
592
|
+
*/
|
|
593
|
+
private resolveValueContentReference;
|
|
594
|
+
private resolveValueContentReferenceToAsset;
|
|
595
|
+
private resolveValueContentReferenceToSharedValue;
|
|
596
|
+
/**
|
|
597
|
+
* Creates an Entry from given EntryFile by resolving it's Values
|
|
546
598
|
*/
|
|
547
|
-
private
|
|
599
|
+
private toEntry;
|
|
548
600
|
}
|
|
549
601
|
|
|
550
602
|
/**
|
|
@@ -564,8 +616,8 @@ declare class SearchService extends AbstractCrudService {
|
|
|
564
616
|
* @param project Project to search in
|
|
565
617
|
* @param query Query to search for
|
|
566
618
|
*/
|
|
567
|
-
search(projectId: string, query: string,
|
|
568
|
-
type: "value" | "project" | "asset" | "collection" | "entry";
|
|
619
|
+
search(projectId: string, query: string, objectType?: ObjectType): Promise<{
|
|
620
|
+
type: "value" | "project" | "asset" | "collection" | "entry" | "sharedValue";
|
|
569
621
|
id: string;
|
|
570
622
|
name: string;
|
|
571
623
|
matches: {
|
|
@@ -590,8 +642,7 @@ declare class ProjectService extends AbstractCrudService implements ExtendedCrud
|
|
|
590
642
|
private assetService;
|
|
591
643
|
private collectionService;
|
|
592
644
|
private entryService;
|
|
593
|
-
|
|
594
|
-
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, userService: UserService, gitService: GitService, searchService: SearchService, assetService: AssetService, collectionService: CollectionService, entryService: EntryService, valueService: ValueService);
|
|
645
|
+
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, userService: UserService, gitService: GitService, searchService: SearchService, assetService: AssetService, collectionService: CollectionService, entryService: EntryService);
|
|
595
646
|
/**
|
|
596
647
|
* Creates a new Project
|
|
597
648
|
*/
|
|
@@ -629,8 +680,8 @@ declare class ProjectService extends AbstractCrudService implements ExtendedCrud
|
|
|
629
680
|
* @param query Query to search for
|
|
630
681
|
* @param type (Optional) specify the type to search for
|
|
631
682
|
*/
|
|
632
|
-
search(projectId: string, query: string, type?:
|
|
633
|
-
type: "value" | "project" | "asset" | "collection" | "entry";
|
|
683
|
+
search(projectId: string, query: string, type?: ObjectType): Promise<{
|
|
684
|
+
type: "value" | "project" | "asset" | "collection" | "entry" | "sharedValue";
|
|
634
685
|
id: string;
|
|
635
686
|
name: string;
|
|
636
687
|
matches: {
|
|
@@ -648,6 +699,7 @@ declare class ProjectService extends AbstractCrudService implements ExtendedCrud
|
|
|
648
699
|
/**
|
|
649
700
|
* Exports given Project to JSON
|
|
650
701
|
*
|
|
702
|
+
* @todo do not read everything before writing to disk -> stream into file given via props
|
|
651
703
|
* @todo performance tests
|
|
652
704
|
* @todo add progress callback
|
|
653
705
|
*/
|
|
@@ -688,8 +740,8 @@ declare const pathTo: {
|
|
|
688
740
|
collectionFile: (projectId: string, id: string) => string;
|
|
689
741
|
entries: (projectId: string, collectionId: string) => string;
|
|
690
742
|
entryFile: (projectId: string, collectionId: string, id: string, language: string) => string;
|
|
691
|
-
|
|
692
|
-
|
|
743
|
+
sharedValues: (projectId: string) => string;
|
|
744
|
+
sharedValueFile: (projectId: string, id: string, language: string) => string;
|
|
693
745
|
assets: (projectId: string) => string;
|
|
694
746
|
assetFile: (projectId: string, id: string, language: string) => string;
|
|
695
747
|
asset: (projectId: string, id: string, language: string, extension: string) => string;
|
|
@@ -781,7 +833,7 @@ declare class ElekIoCore {
|
|
|
781
833
|
private readonly projectService;
|
|
782
834
|
private readonly collectionService;
|
|
783
835
|
private readonly entryService;
|
|
784
|
-
private readonly
|
|
836
|
+
private readonly sharedValueService;
|
|
785
837
|
constructor(props?: ConstructorElekIoCoreProps);
|
|
786
838
|
/**
|
|
787
839
|
* Utility / helper functions
|
|
@@ -810,7 +862,7 @@ declare class ElekIoCore {
|
|
|
810
862
|
/**
|
|
811
863
|
* CRUD methods to work with Values
|
|
812
864
|
*/
|
|
813
|
-
get
|
|
865
|
+
get sharedValues(): SharedValueService;
|
|
814
866
|
}
|
|
815
867
|
|
|
816
868
|
export { ElekIoCore as default };
|