@sneat/dto 0.1.3 → 0.1.6

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.
Files changed (90) hide show
  1. package/esm2022/index.js +2 -0
  2. package/esm2022/index.js.map +1 -0
  3. package/esm2022/lib/by-user.js +2 -0
  4. package/esm2022/lib/by-user.js.map +1 -0
  5. package/esm2022/lib/dto-app.js +2 -0
  6. package/esm2022/lib/dto-app.js.map +1 -0
  7. package/esm2022/lib/dto-brief.js +2 -0
  8. package/esm2022/lib/dto-brief.js.map +1 -0
  9. package/esm2022/lib/dto-commune.js +89 -0
  10. package/esm2022/lib/dto-commune.js.map +1 -0
  11. package/{src/lib/dto-constants.ts → esm2022/lib/dto-constants.js} +1 -0
  12. package/esm2022/lib/dto-constants.js.map +1 -0
  13. package/esm2022/lib/dto-models.js +23 -0
  14. package/esm2022/lib/dto-models.js.map +1 -0
  15. package/esm2022/lib/dto-pricing.js +2 -0
  16. package/esm2022/lib/dto-pricing.js.map +1 -0
  17. package/esm2022/lib/dto-team-brief.js +9 -0
  18. package/esm2022/lib/dto-team-brief.js.map +1 -0
  19. package/esm2022/lib/dto-team-info.js +4 -0
  20. package/esm2022/lib/dto-team-info.js.map +1 -0
  21. package/esm2022/lib/dto-team-meeting.js +2 -0
  22. package/esm2022/lib/dto-team-meeting.js.map +1 -0
  23. package/esm2022/lib/dto-team-metric.js +2 -0
  24. package/esm2022/lib/dto-team-metric.js.map +1 -0
  25. package/esm2022/lib/dto-team.js +2 -0
  26. package/esm2022/lib/dto-team.js.map +1 -0
  27. package/esm2022/lib/dto-user.js +33 -0
  28. package/esm2022/lib/dto-user.js.map +1 -0
  29. package/esm2022/lib/dto-with-modified.js +2 -0
  30. package/esm2022/lib/dto-with-modified.js.map +1 -0
  31. package/esm2022/lib/index.js +19 -0
  32. package/esm2022/lib/index.js.map +1 -0
  33. package/esm2022/lib/period.js +2 -0
  34. package/esm2022/lib/period.js.map +1 -0
  35. package/esm2022/lib/types.js +2 -0
  36. package/esm2022/lib/types.js.map +1 -0
  37. package/esm2022/lib/ui-state.js +2 -0
  38. package/esm2022/lib/ui-state.js.map +1 -0
  39. package/esm2022/lib/with-related.js +94 -0
  40. package/esm2022/lib/with-related.js.map +1 -0
  41. package/esm2022/sneat-dto.js +5 -0
  42. package/esm2022/sneat-dto.js.map +1 -0
  43. package/lib/by-user.d.ts +4 -0
  44. package/lib/dto-app.d.ts +6 -0
  45. package/{src/lib/dto-brief.ts → lib/dto-brief.d.ts} +2 -2
  46. package/lib/dto-commune.d.ts +53 -0
  47. package/lib/dto-constants.d.ts +2 -0
  48. package/lib/dto-models.d.ts +59 -0
  49. package/lib/dto-pricing.d.ts +5 -0
  50. package/lib/dto-team-brief.d.ts +9 -0
  51. package/lib/dto-team-info.d.ts +8 -0
  52. package/lib/dto-team-meeting.d.ts +6 -0
  53. package/lib/dto-team-metric.d.ts +20 -0
  54. package/lib/dto-team.d.ts +12 -0
  55. package/lib/dto-user.d.ts +31 -0
  56. package/lib/dto-with-modified.d.ts +26 -0
  57. package/lib/types.d.ts +7 -0
  58. package/lib/ui-state.d.ts +5 -0
  59. package/lib/with-related.d.ts +42 -0
  60. package/package.json +14 -2
  61. package/sneat-dto.d.ts +5 -0
  62. package/tsconfig.lib.prod.tsbuildinfo +1 -0
  63. package/eslint.config.js +0 -7
  64. package/ng-package.json +0 -7
  65. package/project.json +0 -38
  66. package/src/lib/by-user.ts +0 -4
  67. package/src/lib/dto-app.ts +0 -9
  68. package/src/lib/dto-commune.ts +0 -158
  69. package/src/lib/dto-constants.spec.ts +0 -7
  70. package/src/lib/dto-models.ts +0 -105
  71. package/src/lib/dto-pricing.ts +0 -5
  72. package/src/lib/dto-team-brief.ts +0 -20
  73. package/src/lib/dto-team-info.ts +0 -15
  74. package/src/lib/dto-team-meeting.ts +0 -6
  75. package/src/lib/dto-team-metric.ts +0 -29
  76. package/src/lib/dto-team.ts +0 -27
  77. package/src/lib/dto-user.ts +0 -85
  78. package/src/lib/dto-with-modified.ts +0 -32
  79. package/src/lib/types.ts +0 -34
  80. package/src/lib/ui-state.ts +0 -5
  81. package/src/lib/with-related.ts +0 -180
  82. package/src/test-setup.ts +0 -1
  83. package/tsconfig.json +0 -13
  84. package/tsconfig.lib.json +0 -19
  85. package/tsconfig.lib.prod.json +0 -7
  86. package/tsconfig.spec.json +0 -31
  87. package/vite.config.mts +0 -10
  88. /package/{src/index.ts → index.d.ts} +0 -0
  89. /package/{src/lib/index.ts → lib/index.d.ts} +0 -0
  90. /package/{src/lib/period.ts → lib/period.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ import { SpaceType } from '@sneat/core';
2
+ export interface ISpaceBrief {
3
+ readonly title: string;
4
+ readonly type: SpaceType;
5
+ readonly parentSpaceID?: string;
6
+ readonly roles?: string[];
7
+ }
8
+ export declare const equalSpaceBriefs: (v1?: ISpaceBrief | null | undefined, v2?: ISpaceBrief | null | undefined) => boolean;
9
+ export declare const isSpaceSupportsMemberGroups: (t: SpaceType) => boolean;
@@ -0,0 +1,8 @@
1
+ import { SpaceType } from '@sneat/core';
2
+ import { IUserCommuneInfo } from './dto-user';
3
+ export interface IShortSpaceInfo {
4
+ type: SpaceType;
5
+ id?: string;
6
+ title?: string;
7
+ }
8
+ export declare function createShortCommuneInfoFromUserCommuneInfo(v: IUserCommuneInfo): IShortSpaceInfo;
@@ -0,0 +1,6 @@
1
+ export interface IMeetingInfo {
2
+ id: string;
3
+ stage: string;
4
+ started?: string;
5
+ finished?: string;
6
+ }
@@ -0,0 +1,20 @@
1
+ export type MetricColor = 'primary' | 'secondary' | 'tertiary' | 'success' | 'danger' | 'warning';
2
+ export interface IBoolMetricVal {
3
+ label: string;
4
+ color: MetricColor;
5
+ }
6
+ export interface IBoolMetric {
7
+ true: IBoolMetricVal;
8
+ false: IBoolMetricVal;
9
+ }
10
+ export interface ISpaceMetric {
11
+ id?: string;
12
+ title: string;
13
+ colorTrue?: MetricColor;
14
+ colorFalse?: MetricColor;
15
+ type: 'bool' | 'integer' | 'options';
16
+ mode: 'personal' | 'team';
17
+ bool?: IBoolMetric;
18
+ min?: number;
19
+ max?: number;
20
+ }
@@ -0,0 +1,12 @@
1
+ import { ITotalsHolder } from './dto-models';
2
+ import { ISpaceBrief } from './dto-team-brief';
3
+ import { ISpaceMetric } from './dto-team-metric';
4
+ export interface ISpaceDbo extends ISpaceBrief, ITotalsHolder {
5
+ readonly countryID: string;
6
+ readonly userIDs: string[];
7
+ metrics: ISpaceMetric[];
8
+ upcomingRetro?: {
9
+ itemsByUserAndType?: Record<string, Record<string, number>>;
10
+ };
11
+ noContactRoles?: string[];
12
+ }
@@ -0,0 +1,31 @@
1
+ import { ITitledRecord } from './dto-models';
2
+ import { ICommuneDbo } from './dto-commune';
3
+ import { CommuneType, CountryId } from './types';
4
+ export interface IUserCommuneInfo {
5
+ id?: string;
6
+ shortId?: string;
7
+ title?: string;
8
+ type: CommuneType;
9
+ }
10
+ export declare function createUserCommuneInfoFromCommuneDto(communeDto: ICommuneDbo, shortId?: string): IUserCommuneInfo;
11
+ export interface IUserDbo extends ITitledRecord {
12
+ countryIds?: CountryId[];
13
+ created: {
14
+ hostOrApp: string;
15
+ at: string;
16
+ };
17
+ readonly communes?: readonly IUserCommuneInfo[];
18
+ communesCount?: number;
19
+ isAnonymous: boolean;
20
+ isDemo?: boolean;
21
+ autogeneratedPassword?: string;
22
+ emailVerified?: boolean;
23
+ email?: string;
24
+ emailOriginal?: string;
25
+ gender?: 'male' | 'female' | 'undisclosed';
26
+ }
27
+ export declare function addCommuneToUserDto(userDto: IUserDbo, communeInfo: IUserCommuneInfo): IUserDbo;
28
+ export declare class UserModel {
29
+ static getCommuneInfoByShortId(id: string, communes?: readonly IUserCommuneInfo[]): IUserCommuneInfo | undefined;
30
+ static getCommuneInfoById(id: string, communes: readonly IUserCommuneInfo[]): IUserCommuneInfo | undefined;
31
+ }
@@ -0,0 +1,26 @@
1
+ export interface timestamp {
2
+ seconds: number;
3
+ nanoseconds: number;
4
+ }
5
+ export declare const emptyTimestamp: timestamp;
6
+ export interface IWithCreatedShort {
7
+ readonly at: string;
8
+ readonly by: string;
9
+ }
10
+ export interface IWithCreatedOn {
11
+ readonly createdOn: string;
12
+ }
13
+ export interface IWithCreated {
14
+ readonly createdAt: timestamp;
15
+ readonly createdBy: string;
16
+ }
17
+ export interface IWithUpdated {
18
+ readonly updatedAt: timestamp;
19
+ readonly updatedBy: string;
20
+ }
21
+ export interface IWithDeleted {
22
+ readonly deletedAt?: timestamp;
23
+ readonly deletedBy?: string;
24
+ }
25
+ export interface IWithModified extends IWithCreated, IWithUpdated, IWithDeleted {
26
+ }
package/lib/types.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { SpaceType } from '@sneat/core';
2
+ export { SpaceMemberType } from '@sneat/auth-models';
3
+ export type Restriction = 'adults_only' | 'personal' | string;
4
+ export type SneatRecordStatus = 'active' | 'archived' | 'deleted';
5
+ export type CommuneType = SpaceType;
6
+ export type CountryId = 'IE' | 'US' | 'UK' | 'RU' | 'FR' | 'ES' | 'AU' | 'ZA' | string;
7
+ export type CommuneItemCounter = 'activities' | 'assets' | 'assetGroups' | 'contacts' | 'documents' | 'liabilities' | 'members' | 'memberGroups' | 'overdues' | 'regularTasks' | 'todos' | 'upcomings';
@@ -0,0 +1,5 @@
1
+ export interface UiState {
2
+ readonly isAdding?: boolean;
3
+ readonly isDeleting?: boolean;
4
+ readonly isReordering?: boolean;
5
+ }
@@ -0,0 +1,42 @@
1
+ import { IWithCreatedShort } from './dto-with-modified';
2
+ export interface IRelatedItemKey {
3
+ readonly itemID: string;
4
+ readonly spaceID?: string;
5
+ }
6
+ export interface ISpaceModuleItemRef {
7
+ readonly module: string;
8
+ readonly collection: string;
9
+ readonly spaceID: string;
10
+ readonly itemID: string;
11
+ }
12
+ export interface IRelationshipRole {
13
+ readonly created: IWithCreatedShort;
14
+ }
15
+ export type WritableRelationshipRoles = Record<string, IRelationshipRole>;
16
+ export type IRelationshipRoles = Readonly<WritableRelationshipRoles>;
17
+ export interface IRelatedItem {
18
+ readonly rolesOfItem?: IRelationshipRoles;
19
+ readonly rolesToItem?: IRelationshipRoles;
20
+ }
21
+ export type IRelatedItems = Readonly<Record<string, IRelatedItem>>;
22
+ export type IRelatedCollections = Readonly<Record<string, IRelatedItems>>;
23
+ export type IRelatedModules = Readonly<Record<string, IRelatedCollections>>;
24
+ export interface IRelatedTo extends IWithRelatedOnly {
25
+ readonly key: ISpaceModuleItemRef;
26
+ readonly title: string;
27
+ }
28
+ export declare function getRelatedItems(moduleId: string, collectionId: string, related?: IRelatedModules): IRelatedItems;
29
+ export interface IWithRelatedOnly {
30
+ readonly related?: IRelatedModules;
31
+ }
32
+ export declare function validateRelated(related?: IRelatedModules): void;
33
+ export interface IWithRelatedAndRelatedIDs extends IWithRelatedOnly {
34
+ readonly relatedIDs?: readonly string[];
35
+ }
36
+ export declare const addRelatedItem: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef, rolesOfItem?: IRelationshipRoles) => Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, IRelatedItem>>>>>>;
37
+ export declare const removeRelatedItem: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef) => Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, IRelatedItem>>>>>> | undefined;
38
+ export declare const getLongRelatedItemID: (itemID: string, spaceID: string) => string;
39
+ export declare const getRelatedItemByIDs: (relatedItems: Readonly<Record<string, IRelatedItem>> | undefined, itemID: string, spaceID?: string) => IRelatedItem | undefined;
40
+ export declare const getRelatedItemByKey: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef) => IRelatedItem | undefined;
41
+ export declare const getRelatedItemIDs: (related: IRelatedModules | undefined, module: string, collection: string, spaceID?: string) => readonly string[];
42
+ export declare const hasRelated: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/dto",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,5 +10,17 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "tslib": "2.8.1"
13
- }
13
+ },
14
+ "module": "esm2022/sneat-dto.js",
15
+ "typings": "sneat-dto.d.ts",
16
+ "exports": {
17
+ "./package.json": {
18
+ "default": "./package.json"
19
+ },
20
+ ".": {
21
+ "types": "./sneat-dto.d.ts",
22
+ "default": "./esm2022/sneat-dto.js"
23
+ }
24
+ },
25
+ "sideEffects": false
14
26
  }
package/sneat-dto.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@sneat/dto" />
5
+ export * from './index';