@elek-io/core 0.2.0 → 0.3.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/README.md +12 -10
- package/dist/index.cjs +122 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -99
- package/dist/index.d.ts +5 -99
- package/dist/index.js +105 -272
- 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, 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,
|
|
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, 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';
|
|
@@ -459,43 +459,6 @@ declare class CollectionService extends AbstractCrudService implements ExtendedC
|
|
|
459
459
|
isCollection(obj: BaseFile | unknown): obj is Collection;
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
/**
|
|
463
|
-
* Service that manages CRUD functionality for shared Value files on disk
|
|
464
|
-
*/
|
|
465
|
-
declare class SharedValueService extends AbstractCrudService implements ExtendedCrudService<SharedValue> {
|
|
466
|
-
private jsonFileService;
|
|
467
|
-
private gitService;
|
|
468
|
-
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, assetService: AssetService);
|
|
469
|
-
/**
|
|
470
|
-
* Creates a new shared Value
|
|
471
|
-
*/
|
|
472
|
-
create(props: CreateSharedValueProps): Promise<SharedValue>;
|
|
473
|
-
/**
|
|
474
|
-
* Returns a shared Value by ID and language
|
|
475
|
-
*/
|
|
476
|
-
read(props: ReadSharedValueProps): Promise<SharedValue>;
|
|
477
|
-
/**
|
|
478
|
-
* Updates given shared Values content
|
|
479
|
-
*
|
|
480
|
-
* The valueType cannot be changed after creating the shared Value
|
|
481
|
-
*/
|
|
482
|
-
update(props: UpdateSharedValueProps): Promise<SharedValue>;
|
|
483
|
-
/**
|
|
484
|
-
* Deletes given shared Value
|
|
485
|
-
*/
|
|
486
|
-
delete(props: DeleteSharedValueProps): Promise<void>;
|
|
487
|
-
list(props: ListSharedValuesProps): Promise<PaginatedList<SharedValue>>;
|
|
488
|
-
count(props: CountValuesProps): Promise<number>;
|
|
489
|
-
/**
|
|
490
|
-
* Checks if given object is a shared Value
|
|
491
|
-
*/
|
|
492
|
-
isSharedValue(obj: BaseFile | unknown): obj is SharedValue;
|
|
493
|
-
/**
|
|
494
|
-
* Reads the given shared Values content based on it's ValueType
|
|
495
|
-
*/
|
|
496
|
-
private validate;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
462
|
/**
|
|
500
463
|
* Service that manages CRUD functionality for Entry files on disk
|
|
501
464
|
*/
|
|
@@ -504,8 +467,7 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
504
467
|
private gitService;
|
|
505
468
|
private collectionService;
|
|
506
469
|
private assetService;
|
|
507
|
-
|
|
508
|
-
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, collectionService: CollectionService, assetService: AssetService, sharedValueService: SharedValueService);
|
|
470
|
+
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, collectionService: CollectionService, assetService: AssetService);
|
|
509
471
|
/**
|
|
510
472
|
* Creates a new Entry for given Collection
|
|
511
473
|
*/
|
|
@@ -522,58 +484,7 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
522
484
|
* Deletes given Entry from it's Collection
|
|
523
485
|
*/
|
|
524
486
|
delete(props: DeleteEntryProps): Promise<void>;
|
|
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
|
-
})[];
|
|
571
|
-
id: string;
|
|
572
|
-
objectType: "entry";
|
|
573
|
-
created: number;
|
|
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";
|
|
575
|
-
updated?: number | undefined;
|
|
576
|
-
}>>;
|
|
487
|
+
list(props: ListEntriesProps): Promise<_elek_io_shared.PaginatedList<Entry>>;
|
|
577
488
|
count(props: CountEntriesProps): Promise<number>;
|
|
578
489
|
/**
|
|
579
490
|
* Checks if given object is of type Entry
|
|
@@ -592,7 +503,7 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
592
503
|
*/
|
|
593
504
|
private resolveValueContentReference;
|
|
594
505
|
private resolveValueContentReferenceToAsset;
|
|
595
|
-
private
|
|
506
|
+
private resolveValueContentReferenceToEntry;
|
|
596
507
|
/**
|
|
597
508
|
* Creates an Entry from given EntryFile by resolving it's Values
|
|
598
509
|
*/
|
|
@@ -739,7 +650,7 @@ declare const pathTo: {
|
|
|
739
650
|
collection: (projectId: string, id: string) => string;
|
|
740
651
|
collectionFile: (projectId: string, id: string) => string;
|
|
741
652
|
entries: (projectId: string, collectionId: string) => string;
|
|
742
|
-
entryFile: (projectId: string, collectionId: string, id: string
|
|
653
|
+
entryFile: (projectId: string, collectionId: string, id: string) => string;
|
|
743
654
|
sharedValues: (projectId: string) => string;
|
|
744
655
|
sharedValueFile: (projectId: string, id: string, language: string) => string;
|
|
745
656
|
assets: (projectId: string) => string;
|
|
@@ -833,7 +744,6 @@ declare class ElekIoCore {
|
|
|
833
744
|
private readonly projectService;
|
|
834
745
|
private readonly collectionService;
|
|
835
746
|
private readonly entryService;
|
|
836
|
-
private readonly sharedValueService;
|
|
837
747
|
constructor(props?: ConstructorElekIoCoreProps);
|
|
838
748
|
/**
|
|
839
749
|
* Utility / helper functions
|
|
@@ -859,10 +769,6 @@ declare class ElekIoCore {
|
|
|
859
769
|
* CRUD methods to work with Entries
|
|
860
770
|
*/
|
|
861
771
|
get entries(): EntryService;
|
|
862
|
-
/**
|
|
863
|
-
* CRUD methods to work with Values
|
|
864
|
-
*/
|
|
865
|
-
get sharedValues(): SharedValueService;
|
|
866
772
|
}
|
|
867
773
|
|
|
868
774
|
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, 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,
|
|
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, 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';
|
|
@@ -459,43 +459,6 @@ declare class CollectionService extends AbstractCrudService implements ExtendedC
|
|
|
459
459
|
isCollection(obj: BaseFile | unknown): obj is Collection;
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
/**
|
|
463
|
-
* Service that manages CRUD functionality for shared Value files on disk
|
|
464
|
-
*/
|
|
465
|
-
declare class SharedValueService extends AbstractCrudService implements ExtendedCrudService<SharedValue> {
|
|
466
|
-
private jsonFileService;
|
|
467
|
-
private gitService;
|
|
468
|
-
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, assetService: AssetService);
|
|
469
|
-
/**
|
|
470
|
-
* Creates a new shared Value
|
|
471
|
-
*/
|
|
472
|
-
create(props: CreateSharedValueProps): Promise<SharedValue>;
|
|
473
|
-
/**
|
|
474
|
-
* Returns a shared Value by ID and language
|
|
475
|
-
*/
|
|
476
|
-
read(props: ReadSharedValueProps): Promise<SharedValue>;
|
|
477
|
-
/**
|
|
478
|
-
* Updates given shared Values content
|
|
479
|
-
*
|
|
480
|
-
* The valueType cannot be changed after creating the shared Value
|
|
481
|
-
*/
|
|
482
|
-
update(props: UpdateSharedValueProps): Promise<SharedValue>;
|
|
483
|
-
/**
|
|
484
|
-
* Deletes given shared Value
|
|
485
|
-
*/
|
|
486
|
-
delete(props: DeleteSharedValueProps): Promise<void>;
|
|
487
|
-
list(props: ListSharedValuesProps): Promise<PaginatedList<SharedValue>>;
|
|
488
|
-
count(props: CountValuesProps): Promise<number>;
|
|
489
|
-
/**
|
|
490
|
-
* Checks if given object is a shared Value
|
|
491
|
-
*/
|
|
492
|
-
isSharedValue(obj: BaseFile | unknown): obj is SharedValue;
|
|
493
|
-
/**
|
|
494
|
-
* Reads the given shared Values content based on it's ValueType
|
|
495
|
-
*/
|
|
496
|
-
private validate;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
462
|
/**
|
|
500
463
|
* Service that manages CRUD functionality for Entry files on disk
|
|
501
464
|
*/
|
|
@@ -504,8 +467,7 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
504
467
|
private gitService;
|
|
505
468
|
private collectionService;
|
|
506
469
|
private assetService;
|
|
507
|
-
|
|
508
|
-
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, collectionService: CollectionService, assetService: AssetService, sharedValueService: SharedValueService);
|
|
470
|
+
constructor(options: ElekIoCoreOptions, jsonFileService: JsonFileService, gitService: GitService, collectionService: CollectionService, assetService: AssetService);
|
|
509
471
|
/**
|
|
510
472
|
* Creates a new Entry for given Collection
|
|
511
473
|
*/
|
|
@@ -522,58 +484,7 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
522
484
|
* Deletes given Entry from it's Collection
|
|
523
485
|
*/
|
|
524
486
|
delete(props: DeleteEntryProps): Promise<void>;
|
|
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
|
-
})[];
|
|
571
|
-
id: string;
|
|
572
|
-
objectType: "entry";
|
|
573
|
-
created: number;
|
|
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";
|
|
575
|
-
updated?: number | undefined;
|
|
576
|
-
}>>;
|
|
487
|
+
list(props: ListEntriesProps): Promise<_elek_io_shared.PaginatedList<Entry>>;
|
|
577
488
|
count(props: CountEntriesProps): Promise<number>;
|
|
578
489
|
/**
|
|
579
490
|
* Checks if given object is of type Entry
|
|
@@ -592,7 +503,7 @@ declare class EntryService extends AbstractCrudService implements ExtendedCrudSe
|
|
|
592
503
|
*/
|
|
593
504
|
private resolveValueContentReference;
|
|
594
505
|
private resolveValueContentReferenceToAsset;
|
|
595
|
-
private
|
|
506
|
+
private resolveValueContentReferenceToEntry;
|
|
596
507
|
/**
|
|
597
508
|
* Creates an Entry from given EntryFile by resolving it's Values
|
|
598
509
|
*/
|
|
@@ -739,7 +650,7 @@ declare const pathTo: {
|
|
|
739
650
|
collection: (projectId: string, id: string) => string;
|
|
740
651
|
collectionFile: (projectId: string, id: string) => string;
|
|
741
652
|
entries: (projectId: string, collectionId: string) => string;
|
|
742
|
-
entryFile: (projectId: string, collectionId: string, id: string
|
|
653
|
+
entryFile: (projectId: string, collectionId: string, id: string) => string;
|
|
743
654
|
sharedValues: (projectId: string) => string;
|
|
744
655
|
sharedValueFile: (projectId: string, id: string, language: string) => string;
|
|
745
656
|
assets: (projectId: string) => string;
|
|
@@ -833,7 +744,6 @@ declare class ElekIoCore {
|
|
|
833
744
|
private readonly projectService;
|
|
834
745
|
private readonly collectionService;
|
|
835
746
|
private readonly entryService;
|
|
836
|
-
private readonly sharedValueService;
|
|
837
747
|
constructor(props?: ConstructorElekIoCoreProps);
|
|
838
748
|
/**
|
|
839
749
|
* Utility / helper functions
|
|
@@ -859,10 +769,6 @@ declare class ElekIoCore {
|
|
|
859
769
|
* CRUD methods to work with Entries
|
|
860
770
|
*/
|
|
861
771
|
get entries(): EntryService;
|
|
862
|
-
/**
|
|
863
|
-
* CRUD methods to work with Values
|
|
864
|
-
*/
|
|
865
|
-
get sharedValues(): SharedValueService;
|
|
866
772
|
}
|
|
867
773
|
|
|
868
774
|
export { ElekIoCore as default };
|