jourycms-sdk 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/base.app-container.d.ts +7 -0
- package/dist/base.app-container.d.ts.map +1 -0
- package/dist/base.app-container.js +10 -0
- package/dist/base.client.d.ts +10 -0
- package/dist/base.client.d.ts.map +1 -0
- package/dist/base.client.js +16 -0
- package/dist/base.service-container.d.ts +8 -0
- package/dist/base.service-container.d.ts.map +1 -0
- package/dist/base.service-container.js +12 -0
- package/dist/containers/auth/clients/api-keys.client.d.ts +13 -0
- package/dist/containers/auth/clients/api-keys.client.d.ts.map +1 -0
- package/dist/containers/auth/clients/api-keys.client.js +48 -0
- package/dist/containers/auth/clients/auth.client.d.ts +12 -0
- package/dist/containers/auth/clients/auth.client.d.ts.map +1 -0
- package/dist/containers/auth/clients/auth.client.js +39 -0
- package/dist/containers/auth/clients/permission-groups.client.d.ts +12 -0
- package/dist/containers/auth/clients/permission-groups.client.d.ts.map +1 -0
- package/dist/containers/auth/clients/permission-groups.client.js +42 -0
- package/dist/containers/auth/clients/permissions.client.d.ts +13 -0
- package/dist/containers/auth/clients/permissions.client.d.ts.map +1 -0
- package/dist/containers/auth/clients/permissions.client.js +48 -0
- package/dist/containers/auth/clients/roles.client.d.ts +17 -0
- package/dist/containers/auth/clients/roles.client.d.ts.map +1 -0
- package/dist/containers/auth/clients/roles.client.js +72 -0
- package/dist/containers/auth/clients/users.client.d.ts +26 -0
- package/dist/containers/auth/clients/users.client.d.ts.map +1 -0
- package/dist/containers/auth/clients/users.client.js +128 -0
- package/dist/containers/auth/service-container.d.ts +23 -0
- package/dist/containers/auth/service-container.d.ts.map +1 -0
- package/dist/containers/auth/service-container.js +48 -0
- package/dist/containers/content/clients/article-types.client.d.ts +15 -0
- package/dist/containers/content/clients/article-types.client.d.ts.map +1 -0
- package/dist/containers/content/clients/article-types.client.js +60 -0
- package/dist/containers/content/clients/articles.client.d.ts +15 -0
- package/dist/containers/content/clients/articles.client.d.ts.map +1 -0
- package/dist/containers/content/clients/articles.client.js +60 -0
- package/dist/containers/content/clients/comments.client.d.ts +15 -0
- package/dist/containers/content/clients/comments.client.d.ts.map +1 -0
- package/dist/containers/content/clients/comments.client.js +60 -0
- package/dist/containers/content/clients/reviews.client.d.ts +15 -0
- package/dist/containers/content/clients/reviews.client.d.ts.map +1 -0
- package/dist/containers/content/clients/reviews.client.js +60 -0
- package/dist/containers/content/clients/taxonomies.client.d.ts +15 -0
- package/dist/containers/content/clients/taxonomies.client.d.ts.map +1 -0
- package/dist/containers/content/clients/taxonomies.client.js +60 -0
- package/dist/containers/content/clients/terms.client.d.ts +15 -0
- package/dist/containers/content/clients/terms.client.d.ts.map +1 -0
- package/dist/containers/content/clients/terms.client.js +60 -0
- package/dist/containers/content/clients/translation.items.client.d.ts +16 -0
- package/dist/containers/content/clients/translation.items.client.d.ts.map +1 -0
- package/dist/containers/content/clients/translation.items.client.js +66 -0
- package/dist/containers/content/clients/translation.namespaces.client.d.ts +16 -0
- package/dist/containers/content/clients/translation.namespaces.client.d.ts.map +1 -0
- package/dist/containers/content/clients/translation.namespaces.client.js +66 -0
- package/dist/containers/content/clients/translation.projects.client.d.ts +16 -0
- package/dist/containers/content/clients/translation.projects.client.d.ts.map +1 -0
- package/dist/containers/content/clients/translation.projects.client.js +66 -0
- package/dist/containers/content/service-container.d.ts +29 -0
- package/dist/containers/content/service-container.d.ts.map +1 -0
- package/dist/containers/content/service-container.js +66 -0
- package/dist/containers/storage/clients/files.client.d.ts +13 -0
- package/dist/containers/storage/clients/files.client.d.ts.map +1 -0
- package/dist/containers/storage/clients/files.client.js +48 -0
- package/dist/containers/storage/clients/uploader.client.d.ts +6 -0
- package/dist/containers/storage/clients/uploader.client.d.ts.map +1 -0
- package/dist/containers/storage/clients/uploader.client.js +12 -0
- package/dist/containers/storage/clients/utils.client.d.ts +15 -0
- package/dist/containers/storage/clients/utils.client.d.ts.map +1 -0
- package/dist/containers/storage/clients/utils.client.js +45 -0
- package/dist/containers/storage/service-container.d.ts +31 -0
- package/dist/containers/storage/service-container.d.ts.map +1 -0
- package/dist/containers/storage/service-container.js +63 -0
- package/dist/containers/system/clients/apps.client.d.ts +16 -0
- package/dist/containers/system/clients/apps.client.d.ts.map +1 -0
- package/dist/containers/system/clients/apps.client.js +66 -0
- package/dist/containers/system/service-container.d.ts +13 -0
- package/dist/containers/system/service-container.d.ts.map +1 -0
- package/dist/containers/system/service-container.js +18 -0
- package/dist/exceptions/api-response.exception.d.ts +15 -0
- package/dist/exceptions/api-response.exception.d.ts.map +1 -0
- package/dist/exceptions/api-response.exception.js +26 -0
- package/dist/http-client.d.ts +20 -0
- package/dist/http-client.d.ts.map +1 -0
- package/dist/http-client.js +187 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +237 -0
- package/dist/init-sdk.d.ts +21 -0
- package/dist/init-sdk.d.ts.map +1 -0
- package/dist/init-sdk.js +17 -0
- package/dist/sdk.test.d.ts +1 -0
- package/dist/sdk.test.d.ts.map +1 -0
- package/dist/sdk.test.js +1 -0
- package/dist/utils/helpers.d.ts +5 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +13 -0
- package/dist/utils/logger.d.ts +133 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +176 -0
- package/package.json +49 -0
- package/typings/index.d.ts +1 -0
- package/typings/v1/cache-manager/class.d.ts +0 -0
- package/typings/v1/cache-manager/entity.d.ts +83 -0
- package/typings/v1/cache-manager/index.d.ts +5 -0
- package/typings/v1/cache-manager/store.d.ts +35 -0
- package/typings/v1/events/index.d.ts +3 -0
- package/typings/v1/events/payloads.d.ts +339 -0
- package/typings/v1/index.d.ts +8 -0
- package/typings/v1/lib/execution-scenario/index.d.ts +27 -0
- package/typings/v1/lib/index.d.ts +4 -0
- package/typings/v1/lib/logger/index.d.ts +3 -0
- package/typings/v1/lib/logger/logger.d.ts +53 -0
- package/typings/v1/modules/express/express.d.ts +40 -0
- package/typings/v1/modules/express/index.d.ts +3 -0
- package/typings/v1/modules/index.d.ts +4 -0
- package/typings/v1/modules/mongoose/index.d.ts +3 -0
- package/typings/v1/modules/mongoose/mongoose.d.ts +48 -0
- package/typings/v1/sdk/index.d.ts +3 -0
- package/typings/v1/sdk/sdk.d.ts +158 -0
- package/typings/v1/security/auth-data.d.ts +36 -0
- package/typings/v1/security/index.d.ts +4 -0
- package/typings/v1/security/jwt.d.ts +36 -0
- package/typings/v1/services/auth/api/api-key.d.ts +144 -0
- package/typings/v1/services/auth/api/auth.d.ts +168 -0
- package/typings/v1/services/auth/api/index.d.ts +9 -0
- package/typings/v1/services/auth/api/permission-group.d.ts +95 -0
- package/typings/v1/services/auth/api/permission.d.ts +128 -0
- package/typings/v1/services/auth/api/role.d.ts +193 -0
- package/typings/v1/services/auth/api/tools.d.ts +33 -0
- package/typings/v1/services/auth/api/user.d.ts +391 -0
- package/typings/v1/services/auth/entities/_shared.d.ts +11 -0
- package/typings/v1/services/auth/entities/api-key.d.ts +29 -0
- package/typings/v1/services/auth/entities/federated-credential.d.ts +22 -0
- package/typings/v1/services/auth/entities/index.d.ts +9 -0
- package/typings/v1/services/auth/entities/permission-group.d.ts +20 -0
- package/typings/v1/services/auth/entities/permission.d.ts +24 -0
- package/typings/v1/services/auth/entities/role.d.ts +25 -0
- package/typings/v1/services/auth/entities/user.d.ts +153 -0
- package/typings/v1/services/auth/index.d.ts +5 -0
- package/typings/v1/services/auth/models/.DS_Store +0 -0
- package/typings/v1/services/auth/models/api-key.d.ts +19 -0
- package/typings/v1/services/auth/models/api-key.model.d.ts +3 -0
- package/typings/v1/services/auth/models/federated-credential.d.ts +24 -0
- package/typings/v1/services/auth/models/index.d.ts +9 -0
- package/typings/v1/services/auth/models/permission-group.d.ts +24 -0
- package/typings/v1/services/auth/models/permission.d.ts +22 -0
- package/typings/v1/services/auth/models/role.d.ts +22 -0
- package/typings/v1/services/auth/models/user.d.ts +22 -0
- package/typings/v1/services/content/api/article-type.d.ts +160 -0
- package/typings/v1/services/content/api/article.d.ts +108 -0
- package/typings/v1/services/content/api/comment.d.ts +106 -0
- package/typings/v1/services/content/api/index.d.ts +12 -0
- package/typings/v1/services/content/api/review.d.ts +105 -0
- package/typings/v1/services/content/api/taxonomy.d.ts +101 -0
- package/typings/v1/services/content/api/term.d.ts +101 -0
- package/typings/v1/services/content/api/translation.item.d.ts +195 -0
- package/typings/v1/services/content/api/translation.namespace.d.ts +135 -0
- package/typings/v1/services/content/api/translation.project.d.ts +196 -0
- package/typings/v1/services/content/api/translation.tools.d.ts +85 -0
- package/typings/v1/services/content/entities/article-type.d.ts +51 -0
- package/typings/v1/services/content/entities/article.d.ts +53 -0
- package/typings/v1/services/content/entities/comment.d.ts +34 -0
- package/typings/v1/services/content/entities/index.d.ts +11 -0
- package/typings/v1/services/content/entities/review.d.ts +35 -0
- package/typings/v1/services/content/entities/taxonomy.d.ts +40 -0
- package/typings/v1/services/content/entities/term.d.ts +43 -0
- package/typings/v1/services/content/entities/translation.item.d.ts +48 -0
- package/typings/v1/services/content/entities/translation.namespace.d.ts +29 -0
- package/typings/v1/services/content/entities/translation.project.d.ts +98 -0
- package/typings/v1/services/content/index.d.ts +5 -0
- package/typings/v1/services/content/models/article-type.d.ts +19 -0
- package/typings/v1/services/content/models/article.d.ts +19 -0
- package/typings/v1/services/content/models/comment.d.ts +19 -0
- package/typings/v1/services/content/models/index.d.ts +11 -0
- package/typings/v1/services/content/models/review.d.ts +19 -0
- package/typings/v1/services/content/models/taxonomy.d.ts +19 -0
- package/typings/v1/services/content/models/term.d.ts +19 -0
- package/typings/v1/services/content/models/translation.item.d.ts +21 -0
- package/typings/v1/services/content/models/translation.namespace.d.ts +22 -0
- package/typings/v1/services/content/models/translation.project.d.ts +21 -0
- package/typings/v1/services/index.d.ts +4 -0
- package/typings/v1/services/storage/api/index.d.ts +3 -0
- package/typings/v1/services/storage/api/uploaded-file.d.ts +166 -0
- package/typings/v1/services/storage/entities/index.d.ts +3 -0
- package/typings/v1/services/storage/entities/uploaded-file.d.ts +49 -0
- package/typings/v1/services/storage/index.d.ts +5 -0
- package/typings/v1/services/storage/models/index.d.ts +3 -0
- package/typings/v1/services/storage/models/uploaded-file.d.ts +19 -0
- package/typings/v1/services/system/api/app.d.ts +130 -0
- package/typings/v1/services/system/api/index.d.ts +3 -0
- package/typings/v1/services/system/entities/app.d.ts +97 -0
- package/typings/v1/services/system/entities/index.d.ts +3 -0
- package/typings/v1/services/system/index.d.ts +5 -0
- package/typings/v1/services/system/models/app.d.ts +19 -0
- package/typings/v1/services/system/models/index.d.ts +3 -0
- package/typings/v1/ui/admin/index.d.ts +1 -0
- package/typings/v1/ui/forms/article/custom-fieds/custom-field.d.ts +189 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/article_object.custom-field.d.ts +29 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/boolean.custom-field.d.ts +24 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/checkbox.custom-field.d.ts +26 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/date.custom-field.d.ts +23 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/date_range.custom-field.d.ts +26 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/file.custom-field.d.ts +26 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/image.custom-field.d.ts +25 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/index.d.ts +11 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/number.custom-field.d.ts +26 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/radiobox.custom-field.d.ts +27 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/select.custom-field.d.ts +27 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/text.custom-field.d.ts +26 -0
- package/typings/v1/ui/forms/article/custom-fieds/fields/time.custom-field.d.ts +24 -0
- package/typings/v1/ui/forms/article/custom-fieds/index.d.ts +1 -0
- package/typings/v1/ui/forms/article/index.d.ts +1 -0
- package/typings/v1/ui/forms/index.d.ts +1 -0
- package/typings/v1/ui/index.d.ts +3 -0
- package/typings/v1/ui/routes/index.d.ts +1 -0
- package/typings/v1/ui/routes/routes.d.ts +73 -0
- package/typings/v1/utils/api/index.d.ts +4 -0
- package/typings/v1/utils/api/request.d.ts +215 -0
- package/typings/v1/utils/api/response.d.ts +188 -0
- package/typings/v1/utils/common/common.d.ts +53 -0
- package/typings/v1/utils/common/index.d.ts +3 -0
- package/typings/v1/utils/dev/config.d.ts +135 -0
- package/typings/v1/utils/dev/index.d.ts +4 -0
- package/typings/v1/utils/dev/instrumentation.d.ts +41 -0
- package/typings/v1/utils/entities/entities.d.ts +66 -0
- package/typings/v1/utils/entities/index.d.ts +4 -0
- package/typings/v1/utils/entities/snapshots.d.ts +69 -0
- package/typings/v1/utils/index.d.ts +10 -0
- package/typings/v1/utils/models/index.d.ts +3 -0
- package/typings/v1/utils/models/models.d.ts +50 -0
- package/typings/v1/utils/seed/index.d.ts +3 -0
- package/typings/v1/utils/seed/locations.d.ts +41 -0
- package/typings/v1/utils/system/microservice.d.ts +11 -0
- package/typings/v1/utils/system/models.d.ts +21 -0
- package/typings/v1/utils/utils.d.ts +171 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
declare module Levelup {
|
2
|
+
namespace CMS {
|
3
|
+
namespace V1 {
|
4
|
+
namespace Utils {
|
5
|
+
namespace Dev {
|
6
|
+
namespace Instrumentation {
|
7
|
+
type Instrumentation = {
|
8
|
+
concurrency: number;
|
9
|
+
/**
|
10
|
+
* Sleep time in milliseconds
|
11
|
+
*/
|
12
|
+
sleep: {
|
13
|
+
min: number;
|
14
|
+
max: number;
|
15
|
+
};
|
16
|
+
|
17
|
+
accelerate?:
|
18
|
+
| {
|
19
|
+
min: number;
|
20
|
+
max: number;
|
21
|
+
}
|
22
|
+
| (() => {
|
23
|
+
min: number;
|
24
|
+
max: number;
|
25
|
+
});
|
26
|
+
|
27
|
+
store?: Common.TrackingID;
|
28
|
+
user?: Common.TrackingID;
|
29
|
+
disabled_tasks?: TTaskName[];
|
30
|
+
};
|
31
|
+
|
32
|
+
type Conditions = {
|
33
|
+
service?: System.Entity.TService;
|
34
|
+
disabled?: boolean;
|
35
|
+
auth?: {
|
36
|
+
company?: boolean;
|
37
|
+
office?: boolean;
|
38
|
+
store?: boolean;
|
39
|
+
};
|
40
|
+
compound?: {
|
41
|
+
operator: "AND" | "OR";
|
42
|
+
conditions: (Conditions & { compound: never })[];
|
43
|
+
};
|
44
|
+
};
|
45
|
+
|
46
|
+
type Weight = {
|
47
|
+
min: number;
|
48
|
+
max: number;
|
49
|
+
};
|
50
|
+
|
51
|
+
type Task<Extend extends object = Record<string, any>> = {
|
52
|
+
conditions?: Conditions;
|
53
|
+
weight: Weight;
|
54
|
+
} & Extend;
|
55
|
+
|
56
|
+
type UsersTasks =
|
57
|
+
| ({ name: "users.list" } & Task)
|
58
|
+
| ({ name: "users.create" } & Task<{
|
59
|
+
role?: Auth.Entity.TDefaultUserRoles;
|
60
|
+
name_from_role_and_office?: boolean;
|
61
|
+
}>);
|
62
|
+
type StoresTasks =
|
63
|
+
| ({ name: "stores.list" } & Task)
|
64
|
+
| ({ name: "stores.create" } & Task<{
|
65
|
+
owner?: string;
|
66
|
+
}>);
|
67
|
+
|
68
|
+
type ProductsTasks =
|
69
|
+
| ({ name: "products.list" } & Task)
|
70
|
+
| ({ name: "products.create" } & Task);
|
71
|
+
|
72
|
+
type OrdersTasks =
|
73
|
+
| ({ name: "orders.list" } & Task)
|
74
|
+
| ({ name: "orders.create" } & Task)
|
75
|
+
| ({ name: "orders.changeStatus" } & Task<{
|
76
|
+
status: Orders.Entity.TOrderStatus | "RANDOM";
|
77
|
+
}>);
|
78
|
+
|
79
|
+
type ParcelsTasks =
|
80
|
+
| ({ name: "parcels.list" } & Task)
|
81
|
+
| ({ name: "parcels.create" } & Task)
|
82
|
+
| ({ name: "parcels.changeStatus" } & Task<{
|
83
|
+
status: Shipping.Entity.TParcelStatus | "RANDOM";
|
84
|
+
}>);
|
85
|
+
|
86
|
+
type SacsTasks =
|
87
|
+
| ({ name: "sacs.list" } & Task)
|
88
|
+
| ({ name: "sacs.create" } & Task)
|
89
|
+
| ({ name: "sacs.changeStatus" } & Task<{
|
90
|
+
status: Shipping.Entity.TSacStatus | "RANDOM";
|
91
|
+
}>);
|
92
|
+
|
93
|
+
type TTaskName =
|
94
|
+
// users
|
95
|
+
| "users.list"
|
96
|
+
| "users.create"
|
97
|
+
// stores
|
98
|
+
| "stores.list"
|
99
|
+
| "stores.create"
|
100
|
+
// products
|
101
|
+
| "products.list"
|
102
|
+
| "products.create"
|
103
|
+
// orders
|
104
|
+
| "orders.list"
|
105
|
+
| "orders.create"
|
106
|
+
| "orders.changeStatus"
|
107
|
+
// parcels
|
108
|
+
| "parcels.list"
|
109
|
+
| "parcels.create"
|
110
|
+
| "parcels.changeStatus"
|
111
|
+
// sacs
|
112
|
+
| "sacs.list"
|
113
|
+
| "sacs.create"
|
114
|
+
| "sacs.changeStatus";
|
115
|
+
|
116
|
+
type AnyTask =
|
117
|
+
| UsersTasks
|
118
|
+
| StoresTasks
|
119
|
+
| ProductsTasks
|
120
|
+
| SacsTasks
|
121
|
+
| ParcelsTasks
|
122
|
+
| OrdersTasks;
|
123
|
+
|
124
|
+
type Tasks = AnyTask[];
|
125
|
+
|
126
|
+
type Config = {
|
127
|
+
instrumentation: Instrumentation;
|
128
|
+
tasks: Tasks;
|
129
|
+
};
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
declare module Levelup {
|
2
|
+
namespace CMS {
|
3
|
+
namespace V1 {
|
4
|
+
namespace Utils {
|
5
|
+
namespace Dev {
|
6
|
+
namespace Instrumentation {
|
7
|
+
type TEventName = "sleep" | "info" | "login" | TTaskName;
|
8
|
+
type TStatus = "info" | "success" | "error" | "warn";
|
9
|
+
|
10
|
+
interface IEvent {
|
11
|
+
auth: {
|
12
|
+
app: string; // name
|
13
|
+
company: Levelup.V2.Utils.Entity.Snapshots.Accounts.Company | null;
|
14
|
+
user: Levelup.V2.Utils.Entity.Snapshots.Auth.User | null;
|
15
|
+
store: Levelup.V2.Utils.Entity.Snapshots.Accounts.Store | null;
|
16
|
+
office: Levelup.V2.Utils.Entity.Snapshots.Logistics.Office | null;
|
17
|
+
};
|
18
|
+
date: Date;
|
19
|
+
status: TStatus;
|
20
|
+
event: TEventName;
|
21
|
+
name: string;
|
22
|
+
duration?: number; // in milliseconds
|
23
|
+
entity?: Levelup.V2.SystemStructure.Services.Models.LevelupModels;
|
24
|
+
description?: string;
|
25
|
+
error?: boolean;
|
26
|
+
/**
|
27
|
+
* @param {boolean} fatal
|
28
|
+
* - true: if the error is fatal and the scenario should stop
|
29
|
+
* - false: if the error is not fatal and the scenario should continue
|
30
|
+
*/
|
31
|
+
fatal?: boolean;
|
32
|
+
meta?: {
|
33
|
+
[key: string]: any;
|
34
|
+
};
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
declare module Levelup {
|
2
|
+
namespace CMS {
|
3
|
+
namespace V1 {
|
4
|
+
namespace Utils {
|
5
|
+
namespace Entity {
|
6
|
+
/* ------------------------ COMMON GENERAL INTERFACES ----------------------- */
|
7
|
+
namespace General {
|
8
|
+
type TImportStatus = "draft" | "imported" | "created";
|
9
|
+
type ICreatable = {
|
10
|
+
app?: Utils.Common.ID | null;
|
11
|
+
company?: Utils.Common.ID | null;
|
12
|
+
created_by?: Utils.Common.ID | null;
|
13
|
+
created_by_original_user?: Snapshots.Auth.User | null;
|
14
|
+
created_at?: Date;
|
15
|
+
updated_at?: Date;
|
16
|
+
is_deleted?: boolean;
|
17
|
+
deleted_at?: Date | null;
|
18
|
+
tags?: {
|
19
|
+
[name: string]: any;
|
20
|
+
};
|
21
|
+
updates?: Utils.Entity.General.IItemUpdate[];
|
22
|
+
};
|
23
|
+
|
24
|
+
type IHasSearchMeta = {
|
25
|
+
search_meta?: string;
|
26
|
+
};
|
27
|
+
|
28
|
+
interface IImported {
|
29
|
+
import_status?: TImportStatus;
|
30
|
+
import_id?: string;
|
31
|
+
import_tracking_id?: string;
|
32
|
+
import_index?: number;
|
33
|
+
}
|
34
|
+
|
35
|
+
interface IDeliverable {}
|
36
|
+
|
37
|
+
interface IAttachment {
|
38
|
+
_id: string;
|
39
|
+
url: string;
|
40
|
+
type: string;
|
41
|
+
}
|
42
|
+
|
43
|
+
interface IItemUpdate {
|
44
|
+
updated_by_system?: boolean;
|
45
|
+
updated_by: Snapshots.Auth.User | null;
|
46
|
+
date: Date;
|
47
|
+
action: string;
|
48
|
+
updates: {
|
49
|
+
field: string;
|
50
|
+
old_value: unknown;
|
51
|
+
new_value: unknown;
|
52
|
+
}[];
|
53
|
+
}
|
54
|
+
|
55
|
+
interface IDateRangObject {
|
56
|
+
start: string | Date;
|
57
|
+
end: string | Date;
|
58
|
+
}
|
59
|
+
|
60
|
+
export type HasStartEnd = IDateRangObject;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
declare module Levelup {
|
2
|
+
namespace CMS {
|
3
|
+
namespace V1 {
|
4
|
+
namespace Utils {
|
5
|
+
namespace Entity {
|
6
|
+
/* ------------------------ COMMON GENERAL INTERFACES ----------------------- */
|
7
|
+
namespace Snapshots {
|
8
|
+
/* ------------------------- COMMON AUTH INTERFACES ------------------------- */
|
9
|
+
namespace Auth {
|
10
|
+
interface User {
|
11
|
+
_id: string | null;
|
12
|
+
tracking_id: string | null;
|
13
|
+
first_name: string | null;
|
14
|
+
family_name: string | null;
|
15
|
+
phones: string[];
|
16
|
+
photo: Common.FileAttribute;
|
17
|
+
role: string;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
/* ----------------------- COMMON LOCATIONS INTERFACES ---------------------- */
|
22
|
+
export namespace Locations {
|
23
|
+
interface Address {
|
24
|
+
country_id: string;
|
25
|
+
country_code: string;
|
26
|
+
country_name: string;
|
27
|
+
state_id: string;
|
28
|
+
state_code: string;
|
29
|
+
state_name: string;
|
30
|
+
state_zone?: number;
|
31
|
+
city_id: string;
|
32
|
+
city_code: string;
|
33
|
+
city_name: string;
|
34
|
+
city_zone?: number;
|
35
|
+
street_address?: string;
|
36
|
+
}
|
37
|
+
interface City {
|
38
|
+
_id: string;
|
39
|
+
code: string;
|
40
|
+
name: string;
|
41
|
+
country_id: string;
|
42
|
+
state_id: string;
|
43
|
+
country_code: string;
|
44
|
+
state_code: string;
|
45
|
+
country_name: string;
|
46
|
+
state_name: string;
|
47
|
+
}
|
48
|
+
interface State {
|
49
|
+
_id: string;
|
50
|
+
code: string;
|
51
|
+
name: string;
|
52
|
+
country_id: string;
|
53
|
+
country_code: string;
|
54
|
+
country_name: string;
|
55
|
+
}
|
56
|
+
interface Country {
|
57
|
+
_id: string;
|
58
|
+
code: string;
|
59
|
+
name: string;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
'generated by levelup';
|
2
|
+
|
3
|
+
export * from "./utils.d.ts";
|
4
|
+
export * from "./seed/index.d.ts";
|
5
|
+
export * from "./models/index.d.ts";
|
6
|
+
export * from "./insights/index.d.ts";
|
7
|
+
export * from "./entities/index.d.ts";
|
8
|
+
export * from "./dev/index.d.ts";
|
9
|
+
export * from "./common/index.d.ts";
|
10
|
+
export * from "./api/index.d.ts";
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { SchemaDefinitionProperty } from "mongoose";
|
2
|
+
|
3
|
+
declare global {
|
4
|
+
namespace Levelup {
|
5
|
+
namespace CMS {
|
6
|
+
namespace V1 {
|
7
|
+
namespace Utils {
|
8
|
+
namespace Mongodb {
|
9
|
+
export type StrictSchemaDefinition<
|
10
|
+
T = undefined,
|
11
|
+
EnforcedDocType = any,
|
12
|
+
> = T extends undefined
|
13
|
+
? { [path: string]: SchemaDefinitionProperty }
|
14
|
+
: {
|
15
|
+
[path in keyof Complete<T>]: SchemaDefinitionProperty<
|
16
|
+
Complete<T>[path],
|
17
|
+
EnforcedDocType
|
18
|
+
>;
|
19
|
+
};
|
20
|
+
|
21
|
+
type DeepStrictSchemaDefinition<
|
22
|
+
T = undefined,
|
23
|
+
EnforcedDocType = any,
|
24
|
+
> = {
|
25
|
+
[K in keyof Required<T>]: T[K] extends Date
|
26
|
+
? SchemaDefinitionProperty<T[K], EnforcedDocType>
|
27
|
+
: T[K] extends object & { push?: never; unshift?: never }
|
28
|
+
?
|
29
|
+
| DeepStrictSchemaDefinition<T[K], EnforcedDocType>
|
30
|
+
| {
|
31
|
+
type: DeepStrictSchemaDefinition<
|
32
|
+
T[K],
|
33
|
+
EnforcedDocType
|
34
|
+
>;
|
35
|
+
default?: T[K] | undefined;
|
36
|
+
required?: boolean;
|
37
|
+
unique?: boolean;
|
38
|
+
index?: boolean;
|
39
|
+
ref?: string;
|
40
|
+
_id?: false;
|
41
|
+
}
|
42
|
+
: // : SchemaDefinition;
|
43
|
+
SchemaDefinitionProperty<T[K], EnforcedDocType>;
|
44
|
+
};
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
declare module Levelup {
|
2
|
+
namespace CMS {
|
3
|
+
namespace V1 {
|
4
|
+
namespace Utils {
|
5
|
+
export namespace Seed {
|
6
|
+
export interface SeedData {
|
7
|
+
countries: Country[];
|
8
|
+
countryFlags: { [key: string]: string };
|
9
|
+
dzStatesShipmentFees: DzStatesShipmentFees;
|
10
|
+
dzStates: { [key: string]: string };
|
11
|
+
dzCities: { state: string; cities: DzCity[] }[];
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface Country {
|
15
|
+
id: number;
|
16
|
+
name: string;
|
17
|
+
alpha2: string;
|
18
|
+
alpha3: string;
|
19
|
+
}
|
20
|
+
|
21
|
+
export interface DzCity {
|
22
|
+
id: number;
|
23
|
+
nom: string;
|
24
|
+
wilaya_id: number;
|
25
|
+
sac_wilaya_id: number;
|
26
|
+
hasHub: number;
|
27
|
+
hasdesk: number;
|
28
|
+
deliverable: number;
|
29
|
+
dureedeviecolis: number;
|
30
|
+
dureedeviepaiement: number;
|
31
|
+
}
|
32
|
+
|
33
|
+
export interface DzStatesShipmentFees {
|
34
|
+
home: { [key: string]: number };
|
35
|
+
desk: { [key: string]: number };
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
declare module Levelup {
|
2
|
+
namespace CMS {
|
3
|
+
namespace V1 {
|
4
|
+
namespace Utils {
|
5
|
+
namespace SystemStructure {
|
6
|
+
namespace Models {
|
7
|
+
/**
|
8
|
+
* TODO: finish this
|
9
|
+
*/
|
10
|
+
export type AllModels = string;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* TODO: finish this
|
14
|
+
*/
|
15
|
+
export type EntityType<M extends AllModels> = any;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,171 @@
|
|
1
|
+
// import { Document, Model } from 'mongoose';
|
2
|
+
|
3
|
+
declare module Levelup {
|
4
|
+
namespace CMS {
|
5
|
+
namespace V1 {
|
6
|
+
namespace Utils {
|
7
|
+
export type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
|
8
|
+
export type PropTypeNonNullable<
|
9
|
+
TObj,
|
10
|
+
TProp extends keyof TObj,
|
11
|
+
> = NonNullable<TObj[TProp]>;
|
12
|
+
|
13
|
+
export type Maybe<T> = T | null;
|
14
|
+
export type Exact<T extends { [key: string]: unknown }> = {
|
15
|
+
[K in keyof T]: T[K];
|
16
|
+
};
|
17
|
+
export type Complete<T> = {
|
18
|
+
[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>>
|
19
|
+
? T[P]
|
20
|
+
: T[P] | undefined;
|
21
|
+
};
|
22
|
+
|
23
|
+
// Type utility to extract string literals recursively
|
24
|
+
type RecursiveKeyUnion<T> = T extends object
|
25
|
+
? { [K in keyof T]: RecursiveKeyUnion<T[K]> }[keyof T]
|
26
|
+
: T;
|
27
|
+
|
28
|
+
type DeepComplete<T = undefined> = {
|
29
|
+
[K in keyof Complete<T>]: T[K] extends Date
|
30
|
+
? Date
|
31
|
+
: T[K] extends object & { push?: never; unshift?: never }
|
32
|
+
? DeepComplete<T[K]>
|
33
|
+
: NonUndefined<T[K]>;
|
34
|
+
};
|
35
|
+
|
36
|
+
export type NonUndefined<T> = T extends undefined ? never : T;
|
37
|
+
|
38
|
+
type MergeTypes<A, B> = {
|
39
|
+
[key in keyof A]: key extends keyof B ? B[key] : A[key];
|
40
|
+
} & B;
|
41
|
+
|
42
|
+
export type Frequency =
|
43
|
+
| {
|
44
|
+
frequency: "everyMinute" | "everyHour" | "everyDay";
|
45
|
+
}
|
46
|
+
| {
|
47
|
+
frequency: "custom";
|
48
|
+
interval:
|
49
|
+
| `every ${number}s`
|
50
|
+
| `every ${number}m`
|
51
|
+
| `every ${number}h`
|
52
|
+
| `every ${number}h ${number}m`
|
53
|
+
| `every ${number}h ${number}m ${number}s`;
|
54
|
+
};
|
55
|
+
|
56
|
+
export type DocumentProperties<T> = T extends object & {
|
57
|
+
push?: never;
|
58
|
+
unshift?: never;
|
59
|
+
}
|
60
|
+
? {
|
61
|
+
[K in keyof T]-?: K extends string | number
|
62
|
+
?
|
63
|
+
| `${K}`
|
64
|
+
| `${K}.${DocumentProperties<T[K]>}`
|
65
|
+
| (T extends { attributes?: object }
|
66
|
+
? DocumentRootProperties<T["attributes"]>
|
67
|
+
: never)
|
68
|
+
| (T[K] extends Array<any>
|
69
|
+
? `${K}.${DocumentProperties<T[K][number]>}`
|
70
|
+
: never)
|
71
|
+
: never;
|
72
|
+
}[keyof T]
|
73
|
+
: never;
|
74
|
+
|
75
|
+
export type ExcludeDocumentProperties<T> = T extends object & {
|
76
|
+
push?: never;
|
77
|
+
unshift?: never;
|
78
|
+
}
|
79
|
+
? {
|
80
|
+
[K in keyof T]-?: K extends string | number
|
81
|
+
?
|
82
|
+
| `-${K}`
|
83
|
+
| `-${K}.${DocumentProperties<T[K]>}`
|
84
|
+
| (T extends { attributes?: object }
|
85
|
+
? ExcludeDocumentRootProperties<T["attributes"]>
|
86
|
+
: never)
|
87
|
+
| (T[K] extends Array<any>
|
88
|
+
? `${K}.${DocumentProperties<T[K][number]>}`
|
89
|
+
: never)
|
90
|
+
: never;
|
91
|
+
}[keyof T]
|
92
|
+
: never;
|
93
|
+
|
94
|
+
export type DocumentRootProperties<T> = T extends object
|
95
|
+
? {
|
96
|
+
[K in keyof T]-?: K extends string | number ? `${K}` : never;
|
97
|
+
}[keyof T]
|
98
|
+
: never;
|
99
|
+
|
100
|
+
export type ExcludeDocumentRootProperties<T> = T extends object
|
101
|
+
? {
|
102
|
+
[K in keyof T]-?: K extends string | number ? `-${K}` : never;
|
103
|
+
}[keyof T]
|
104
|
+
: never;
|
105
|
+
|
106
|
+
export type DeepKeys<T> = T extends object & {
|
107
|
+
push?: never;
|
108
|
+
unshift?: never;
|
109
|
+
}
|
110
|
+
? {
|
111
|
+
[K in keyof T]-?: K extends string | number
|
112
|
+
? `${K}` | `${K}.${DeepKeys<T[K]>}`
|
113
|
+
: never;
|
114
|
+
}[keyof T]
|
115
|
+
: never;
|
116
|
+
|
117
|
+
export type DeepStringKeys<T> = T extends object & {
|
118
|
+
push?: never;
|
119
|
+
unshift?: never;
|
120
|
+
}
|
121
|
+
? {
|
122
|
+
[K in keyof T]-?: K extends string | number
|
123
|
+
? `${K}.${DeepKeys<T[K]>}`
|
124
|
+
: never;
|
125
|
+
}[keyof T]
|
126
|
+
: never;
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Update : LeafKeys excludes the keys of object values
|
130
|
+
* @author dr. Salmi <reevosolutions@gmail.com>
|
131
|
+
* @since 29-10-2024 19:18:23
|
132
|
+
*/
|
133
|
+
type LeafKeys<T> = T extends object
|
134
|
+
? {
|
135
|
+
[K in Extract<keyof T, string | number>]: T[K] extends object
|
136
|
+
? `${K}.${LeafKeys<T[K]>}`
|
137
|
+
: `${K}`;
|
138
|
+
}[Extract<keyof T, string | number>]
|
139
|
+
: never;
|
140
|
+
|
141
|
+
export type WithRequiredProperty<
|
142
|
+
Type,
|
143
|
+
Key extends keyof Type = keyof Type,
|
144
|
+
> = Type & {
|
145
|
+
[Property in Key]-?: Type[Property];
|
146
|
+
};
|
147
|
+
|
148
|
+
export type WithSelfChildren<T, C extends string> = T & {
|
149
|
+
[Prop in C]?: WithSelfChildren<T, C>[];
|
150
|
+
};
|
151
|
+
|
152
|
+
export type CachedHeavyResult<T> = {
|
153
|
+
last_updated?: Date;
|
154
|
+
next_update?: Date;
|
155
|
+
found?: boolean;
|
156
|
+
expired?: boolean;
|
157
|
+
value?: T;
|
158
|
+
};
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Update : Added
|
162
|
+
* @author dr. Salmi <reevosolutions@gmail.com>
|
163
|
+
* @since 24-10-2024 17:51:08
|
164
|
+
*/
|
165
|
+
export type DeepPartial<T> = {
|
166
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
167
|
+
};
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|