@api-client/core 0.19.23 → 0.19.24

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.
@@ -0,0 +1,81 @@
1
+ import type { FieldValidationMessage } from '../../exceptions/validation_error.js';
2
+ /**
3
+ * Status of the deployment
4
+ */
5
+ export declare enum DeploymentStatus {
6
+ /**
7
+ * Deployment is pending
8
+ */
9
+ Pending = 0,
10
+ /**
11
+ * Deployment is active
12
+ */
13
+ Active = 1,
14
+ /**
15
+ * Deployment is inactive
16
+ */
17
+ Inactive = 2,
18
+ /**
19
+ * Deployment has failed
20
+ */
21
+ Failed = 3
22
+ }
23
+ export interface DeploymentSchema {
24
+ /**
25
+ * Primary key (nanoid)
26
+ */
27
+ id: string;
28
+ /**
29
+ * ID of the organization
30
+ */
31
+ orgId: string;
32
+ /**
33
+ * The file ID representing the API
34
+ */
35
+ apiId: string;
36
+ /**
37
+ * The version of the deployment (e.g., 'v1', 'v2')
38
+ */
39
+ deploymentVersion: string;
40
+ /**
41
+ * The semantic version of the deployed API model (e.g., '1.0.1')
42
+ */
43
+ apiModelVersion: string;
44
+ /**
45
+ * Status of the deployment
46
+ */
47
+ status: DeploymentStatus;
48
+ /**
49
+ * Optional custom path for staging (e.g., '/dev')
50
+ */
51
+ stagingPath?: string;
52
+ /**
53
+ * Reference to the optimized model in MongoDB
54
+ */
55
+ mongoModelId?: string;
56
+ /**
57
+ * Timestamp of creation
58
+ */
59
+ createdAt: number;
60
+ /**
61
+ * Timestamp of last update
62
+ */
63
+ updatedAt: number;
64
+ }
65
+ export declare class Deployment implements DeploymentSchema {
66
+ id: string;
67
+ orgId: string;
68
+ apiId: string;
69
+ deploymentVersion: string;
70
+ apiModelVersion: string;
71
+ status: DeploymentStatus;
72
+ stagingPath?: string;
73
+ mongoModelId?: string;
74
+ createdAt: number;
75
+ updatedAt: number;
76
+ static createSchema(input?: Partial<DeploymentSchema>): DeploymentSchema;
77
+ constructor(state?: Partial<DeploymentSchema>);
78
+ toJSON(): DeploymentSchema;
79
+ validate(): FieldValidationMessage[];
80
+ }
81
+ //# sourceMappingURL=Deployment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Deployment.d.ts","sourceRoot":"","sources":["../../../../src/models/store/Deployment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAGlF;;GAEG;AACH,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,MAAM,IAAI;IACV;;OAEG;IACH,QAAQ,IAAI;IACZ;;OAEG;IACH,MAAM,IAAI;CACX;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAA;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,UAAW,YAAW,gBAAgB;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,MAAM,CAAC,YAAY,CAAC,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;gBAqBhE,KAAK,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAkB7C,MAAM,IAAI,gBAAgB;IAoB1B,QAAQ,IAAI,sBAAsB,EAAE;CAiCrC"}
@@ -0,0 +1,124 @@
1
+ import { nanoid } from '../../nanoid.js';
2
+ /**
3
+ * Status of the deployment
4
+ */
5
+ export var DeploymentStatus;
6
+ (function (DeploymentStatus) {
7
+ /**
8
+ * Deployment is pending
9
+ */
10
+ DeploymentStatus[DeploymentStatus["Pending"] = 0] = "Pending";
11
+ /**
12
+ * Deployment is active
13
+ */
14
+ DeploymentStatus[DeploymentStatus["Active"] = 1] = "Active";
15
+ /**
16
+ * Deployment is inactive
17
+ */
18
+ DeploymentStatus[DeploymentStatus["Inactive"] = 2] = "Inactive";
19
+ /**
20
+ * Deployment has failed
21
+ */
22
+ DeploymentStatus[DeploymentStatus["Failed"] = 3] = "Failed";
23
+ })(DeploymentStatus || (DeploymentStatus = {}));
24
+ export class Deployment {
25
+ id;
26
+ orgId;
27
+ apiId;
28
+ deploymentVersion;
29
+ apiModelVersion;
30
+ status;
31
+ stagingPath;
32
+ mongoModelId;
33
+ createdAt;
34
+ updatedAt;
35
+ static createSchema(input = {}) {
36
+ const id = input.id ?? nanoid();
37
+ const result = {
38
+ id,
39
+ orgId: input.orgId || '',
40
+ apiId: input.apiId || '',
41
+ deploymentVersion: input.deploymentVersion || 'v0',
42
+ apiModelVersion: input.apiModelVersion || '0.0.0',
43
+ status: input.status ?? DeploymentStatus.Pending,
44
+ createdAt: input.createdAt ?? Date.now(),
45
+ updatedAt: input.updatedAt ?? Date.now(),
46
+ };
47
+ if (input.stagingPath) {
48
+ result.stagingPath = input.stagingPath;
49
+ }
50
+ if (input.mongoModelId) {
51
+ result.mongoModelId = input.mongoModelId;
52
+ }
53
+ return result;
54
+ }
55
+ constructor(state) {
56
+ const init = Deployment.createSchema(state);
57
+ this.id = init.id;
58
+ this.orgId = init.orgId;
59
+ this.apiId = init.apiId;
60
+ this.deploymentVersion = init.deploymentVersion;
61
+ this.apiModelVersion = init.apiModelVersion;
62
+ this.status = init.status;
63
+ if (init.stagingPath) {
64
+ this.stagingPath = init.stagingPath;
65
+ }
66
+ if (init.mongoModelId) {
67
+ this.mongoModelId = init.mongoModelId;
68
+ }
69
+ this.createdAt = init.createdAt;
70
+ this.updatedAt = init.updatedAt;
71
+ }
72
+ toJSON() {
73
+ const result = {
74
+ id: this.id,
75
+ orgId: this.orgId,
76
+ apiId: this.apiId,
77
+ deploymentVersion: this.deploymentVersion,
78
+ apiModelVersion: this.apiModelVersion,
79
+ status: this.status,
80
+ createdAt: this.createdAt,
81
+ updatedAt: this.updatedAt,
82
+ };
83
+ if (this.stagingPath) {
84
+ result.stagingPath = this.stagingPath;
85
+ }
86
+ if (this.mongoModelId) {
87
+ result.mongoModelId = this.mongoModelId;
88
+ }
89
+ return result;
90
+ }
91
+ validate() {
92
+ const result = [];
93
+ if (this.orgId === '') {
94
+ result.push({
95
+ field: 'orgId',
96
+ message: 'Org ID must not be empty',
97
+ rule: 'notEmpty',
98
+ });
99
+ }
100
+ if (this.apiId === '') {
101
+ result.push({
102
+ field: 'apiId',
103
+ message: 'API ID must not be empty',
104
+ rule: 'notEmpty',
105
+ });
106
+ }
107
+ if (this.deploymentVersion === '') {
108
+ result.push({
109
+ field: 'deploymentVersion',
110
+ message: 'Deployment version must not be empty',
111
+ rule: 'notEmpty',
112
+ });
113
+ }
114
+ if (this.apiModelVersion === '') {
115
+ result.push({
116
+ field: 'apiModelVersion',
117
+ message: 'API model version must not be empty',
118
+ rule: 'notEmpty',
119
+ });
120
+ }
121
+ return result;
122
+ }
123
+ }
124
+ //# sourceMappingURL=Deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Deployment.js","sourceRoot":"","sources":["../../../../src/models/store/Deployment.ts"],"names":[],"mappings":"AACA,OAAO,E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IAAI,CAAC,WAAW,CAAA;QACvC,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACzC,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,QAAQ;QACN,MAAM,MAAM,GAA6B,EAAE,CAAA;QAE3C,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,0BAA0B;gBACnC,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,0BAA0B;gBACnC,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,iBAAiB,KAAK,EAAE,EAAE,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,mBAAmB;gBAC1B,OAAO,EAAE,sCAAsC;gBAC/C,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,eAAe,KAAK,EAAE,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,iBAAiB;gBACxB,OAAO,EAAE,qCAAqC;gBAC9C,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import type { FieldValidationMessage } from '../../exceptions/validation_error.js'\nimport { nanoid } from '../../nanoid.js'\n\n/**\n * Status of the deployment\n */\nexport enum DeploymentStatus {\n /**\n * Deployment is pending\n */\n Pending = 0,\n /**\n * Deployment is active\n */\n Active = 1,\n /**\n * Deployment is inactive\n */\n Inactive = 2,\n /**\n * Deployment has failed\n */\n Failed = 3,\n}\n\nexport interface DeploymentSchema {\n /**\n * Primary key (nanoid)\n */\n id: string\n /**\n * ID of the organization\n */\n orgId: string\n /**\n * The file ID representing the API\n */\n apiId: string\n /**\n * The version of the deployment (e.g., 'v1', 'v2')\n */\n deploymentVersion: string\n /**\n * The semantic version of the deployed API model (e.g., '1.0.1')\n */\n apiModelVersion: string\n /**\n * Status of the deployment\n */\n status: DeploymentStatus\n /**\n * Optional custom path for staging (e.g., '/dev')\n */\n stagingPath?: string\n /**\n * Reference to the optimized model in MongoDB\n */\n mongoModelId?: string\n /**\n * Timestamp of creation\n */\n createdAt: number\n /**\n * Timestamp of last update\n */\n updatedAt: number\n}\n\nexport class Deployment implements DeploymentSchema {\n id: string\n orgId: string\n apiId: string\n deploymentVersion: string\n apiModelVersion: string\n status: DeploymentStatus\n stagingPath?: string\n mongoModelId?: string\n createdAt: number\n updatedAt: number\n\n static createSchema(input: Partial<DeploymentSchema> = {}): DeploymentSchema {\n const id = input.id ?? nanoid()\n const result: DeploymentSchema = {\n id,\n orgId: input.orgId || '',\n apiId: input.apiId || '',\n deploymentVersion: input.deploymentVersion || 'v0',\n apiModelVersion: input.apiModelVersion || '0.0.0',\n status: input.status ?? DeploymentStatus.Pending,\n createdAt: input.createdAt ?? Date.now(),\n updatedAt: input.updatedAt ?? Date.now(),\n }\n if (input.stagingPath) {\n result.stagingPath = input.stagingPath\n }\n if (input.mongoModelId) {\n result.mongoModelId = input.mongoModelId\n }\n return result\n }\n\n constructor(state?: Partial<DeploymentSchema>) {\n const init = Deployment.createSchema(state)\n this.id = init.id\n this.orgId = init.orgId\n this.apiId = init.apiId\n this.deploymentVersion = init.deploymentVersion\n this.apiModelVersion = init.apiModelVersion\n this.status = init.status\n if (init.stagingPath) {\n this.stagingPath = init.stagingPath\n }\n if (init.mongoModelId) {\n this.mongoModelId = init.mongoModelId\n }\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n }\n\n toJSON(): DeploymentSchema {\n const result: DeploymentSchema = {\n id: this.id,\n orgId: this.orgId,\n apiId: this.apiId,\n deploymentVersion: this.deploymentVersion,\n apiModelVersion: this.apiModelVersion,\n status: this.status,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.stagingPath) {\n result.stagingPath = this.stagingPath\n }\n if (this.mongoModelId) {\n result.mongoModelId = this.mongoModelId\n }\n return result\n }\n\n validate(): FieldValidationMessage[] {\n const result: FieldValidationMessage[] = []\n\n if (this.orgId === '') {\n result.push({\n field: 'orgId',\n message: 'Org ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.apiId === '') {\n result.push({\n field: 'apiId',\n message: 'API ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.deploymentVersion === '') {\n result.push({\n field: 'deploymentVersion',\n message: 'Deployment version must not be empty',\n rule: 'notEmpty',\n })\n }\n if (this.apiModelVersion === '') {\n result.push({\n field: 'apiModelVersion',\n message: 'API model version must not be empty',\n rule: 'notEmpty',\n })\n }\n return result\n }\n}\n"]}
@@ -0,0 +1,52 @@
1
+ import type { FieldValidationMessage } from '../../exceptions/validation_error.js';
2
+ export declare enum SslStatus {
3
+ Initializing = 0,
4
+ PendingDns = 1,
5
+ Issuing = 2,
6
+ Active = 3,
7
+ Error = 4
8
+ }
9
+ export interface DeploymentCustomDomainSchema {
10
+ /**
11
+ * Primary key (nanoid)
12
+ */
13
+ id: string;
14
+ /**
15
+ * ID of the deployment
16
+ */
17
+ deploymentId: string;
18
+ /**
19
+ * ID of the custom domain
20
+ */
21
+ customDomainId: string;
22
+ /**
23
+ * The base path for the deployment
24
+ */
25
+ basePath: string;
26
+ /**
27
+ * Status of the SSL certificate
28
+ */
29
+ sslStatus: SslStatus;
30
+ /**
31
+ * Timestamp of creation
32
+ */
33
+ createdAt: number;
34
+ /**
35
+ * Timestamp of last update
36
+ */
37
+ updatedAt: number;
38
+ }
39
+ export declare class DeploymentCustomDomainModel implements DeploymentCustomDomainSchema {
40
+ id: string;
41
+ deploymentId: string;
42
+ customDomainId: string;
43
+ basePath: string;
44
+ sslStatus: SslStatus;
45
+ createdAt: number;
46
+ updatedAt: number;
47
+ static createSchema(input?: Partial<DeploymentCustomDomainSchema>): DeploymentCustomDomainSchema;
48
+ constructor(state?: Partial<DeploymentCustomDomainSchema>);
49
+ toJSON(): DeploymentCustomDomainSchema;
50
+ validate(): FieldValidationMessage[];
51
+ }
52
+ //# sourceMappingURL=DeploymentCustomDomain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeploymentCustomDomain.d.ts","sourceRoot":"","sources":["../../../../src/models/store/DeploymentCustomDomain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAGlF,oBAAY,SAAS;IACnB,YAAY,IAAI;IAChB,UAAU,IAAI;IACd,OAAO,IAAI;IACX,MAAM,IAAI;IACV,KAAK,IAAI;CACV;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAA;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,2BAA4B,YAAW,4BAA4B;IAC9E,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,MAAM,CAAC,YAAY,CAAC,KAAK,GAAE,OAAO,CAAC,4BAA4B,CAAM,GAAG,4BAA4B;gBAaxF,KAAK,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC;IAWzD,MAAM,IAAI,4BAA4B;IAYtC,QAAQ,IAAI,sBAAsB,EAAE;CAgCrC"}
@@ -0,0 +1,84 @@
1
+ import { nanoid } from '../../nanoid.js';
2
+ export var SslStatus;
3
+ (function (SslStatus) {
4
+ SslStatus[SslStatus["Initializing"] = 0] = "Initializing";
5
+ SslStatus[SslStatus["PendingDns"] = 1] = "PendingDns";
6
+ SslStatus[SslStatus["Issuing"] = 2] = "Issuing";
7
+ SslStatus[SslStatus["Active"] = 3] = "Active";
8
+ SslStatus[SslStatus["Error"] = 4] = "Error";
9
+ })(SslStatus || (SslStatus = {}));
10
+ export class DeploymentCustomDomainModel {
11
+ id;
12
+ deploymentId;
13
+ customDomainId;
14
+ basePath;
15
+ sslStatus;
16
+ createdAt;
17
+ updatedAt;
18
+ static createSchema(input = {}) {
19
+ const id = input.id ?? nanoid();
20
+ return {
21
+ id,
22
+ deploymentId: input.deploymentId || '',
23
+ customDomainId: input.customDomainId || '',
24
+ basePath: input.basePath ?? '/',
25
+ sslStatus: input.sslStatus ?? SslStatus.PendingDns,
26
+ createdAt: input.createdAt ?? Date.now(),
27
+ updatedAt: input.updatedAt ?? Date.now(),
28
+ };
29
+ }
30
+ constructor(state) {
31
+ const init = DeploymentCustomDomainModel.createSchema(state);
32
+ this.id = init.id;
33
+ this.deploymentId = init.deploymentId;
34
+ this.customDomainId = init.customDomainId;
35
+ this.basePath = init.basePath;
36
+ this.sslStatus = init.sslStatus;
37
+ this.createdAt = init.createdAt;
38
+ this.updatedAt = init.updatedAt;
39
+ }
40
+ toJSON() {
41
+ return {
42
+ id: this.id,
43
+ deploymentId: this.deploymentId,
44
+ customDomainId: this.customDomainId,
45
+ basePath: this.basePath,
46
+ sslStatus: this.sslStatus,
47
+ createdAt: this.createdAt,
48
+ updatedAt: this.updatedAt,
49
+ };
50
+ }
51
+ validate() {
52
+ const result = [];
53
+ if (this.basePath === '') {
54
+ result.push({
55
+ field: 'basePath',
56
+ message: 'Base path must not be empty',
57
+ rule: 'notEmpty',
58
+ });
59
+ }
60
+ else if (!this.basePath.startsWith('/')) {
61
+ result.push({
62
+ field: 'basePath',
63
+ message: 'Base path must start with a slash',
64
+ rule: 'startsWithSlash',
65
+ });
66
+ }
67
+ if (!this.deploymentId) {
68
+ result.push({
69
+ field: 'deploymentId',
70
+ message: 'Deployment ID must not be empty',
71
+ rule: 'notEmpty',
72
+ });
73
+ }
74
+ if (!this.customDomainId) {
75
+ result.push({
76
+ field: 'customDomainId',
77
+ message: 'Custom domain ID must not be empty',
78
+ rule: 'notEmpty',
79
+ });
80
+ }
81
+ return result;
82
+ }
83
+ }
84
+ //# sourceMappingURL=DeploymentCustomDomain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeploymentCustomDomain.js","sourceRoot":"","sources":["../../../../src/models/store/DeploymentCustomDomain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,yDAAgB,CAAA;IAChB,qDAAc,CAAA;IACd,+CAAW,CAAA;IACX,6CAAU,CAAA;IACV,2CAAS,CAAA;AACX,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB;AAiCD,MAAM,OAAO,2BAA2B;IACtC,EAAE,CAAQ;IACV,YAAY,CAAQ;IACpB,cAAc,CAAQ;IACtB,QAAQ,CAAQ;IAChB,SAAS,CAAW;IACpB,SAAS,CAAQ;IACjB,SAAS,CAAQ;IAEjB,MAAM,CAAC,YAAY,CAAC,QAA+C,EAAE;QACnE,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,MAAM,EAAE,CAAA;QAC/B,OAAO;YACL,EAAE;YACF,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE;YACtC,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,EAAE;YAC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A6B;gBACtC,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,UAAU;gBACjB,OAAO,EAAE,mCAAmC;gBAC5C,IAAI,EAAE,iBAAiB;aACxB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,cAAc;gBACrB,OAAO,EAAE,iCAAiC;gBAC1C,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,gBAAgB;gBACvB,OAAO,EAAE,oCAAoC;gBAC7C,IAAI,EAAE,UAAU;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import type { FieldValidationMessage } from '../../exceptions/validation_error.js'\nimport { nanoid } from '../../nanoid.js'\n\nexport enum SslStatus {\n Initializing = 0,\n PendingDns = 1,\n Issuing = 2,\n Active = 3,\n Error = 4,\n}\n\nexport interface DeploymentCustomDomainSchema {\n /**\n * Primary key (nanoid)\n */\n id: string\n /**\n * ID of the deployment\n */\n deploymentId: string\n /**\n * ID of the custom domain\n */\n customDomainId: string\n /**\n * The base path for the deployment\n */\n basePath: string\n /**\n * Status of the SSL certificate\n */\n sslStatus: SslStatus\n /**\n * Timestamp of creation\n */\n createdAt: number\n /**\n * Timestamp of last update\n */\n updatedAt: number\n}\n\nexport class DeploymentCustomDomainModel implements DeploymentCustomDomainSchema {\n id: string\n deploymentId: string\n customDomainId: string\n basePath: string\n sslStatus: SslStatus\n createdAt: number\n updatedAt: number\n\n static createSchema(input: Partial<DeploymentCustomDomainSchema> = {}): DeploymentCustomDomainSchema {\n const id = input.id ?? nanoid()\n return {\n id,\n deploymentId: input.deploymentId || '',\n customDomainId: input.customDomainId || '',\n basePath: input.basePath ?? '/',\n sslStatus: input.sslStatus ?? SslStatus.PendingDns,\n createdAt: input.createdAt ?? Date.now(),\n updatedAt: input.updatedAt ?? Date.now(),\n }\n }\n\n constructor(state?: Partial<DeploymentCustomDomainSchema>) {\n const init = DeploymentCustomDomainModel.createSchema(state)\n this.id = init.id\n this.deploymentId = init.deploymentId\n this.customDomainId = init.customDomainId\n this.basePath = init.basePath\n this.sslStatus = init.sslStatus\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n }\n\n toJSON(): DeploymentCustomDomainSchema {\n return {\n id: this.id,\n deploymentId: this.deploymentId,\n customDomainId: this.customDomainId,\n basePath: this.basePath,\n sslStatus: this.sslStatus,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n }\n\n validate(): FieldValidationMessage[] {\n const result: FieldValidationMessage[] = []\n\n if (this.basePath === '') {\n result.push({\n field: 'basePath',\n message: 'Base path must not be empty',\n rule: 'notEmpty',\n })\n } else if (!this.basePath.startsWith('/')) {\n result.push({\n field: 'basePath',\n message: 'Base path must start with a slash',\n rule: 'startsWithSlash',\n })\n }\n if (!this.deploymentId) {\n result.push({\n field: 'deploymentId',\n message: 'Deployment ID must not be empty',\n rule: 'notEmpty',\n })\n }\n if (!this.customDomainId) {\n result.push({\n field: 'customDomainId',\n message: 'Custom domain ID must not be empty',\n rule: 'notEmpty',\n })\n }\n return result\n }\n}\n"]}