@quatrain/core 1.2.12 → 1.2.14
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/common/ResourcesErrors.d.ts +1 -17
- package/dist/common/ResourcesErrors.d.ts.map +1 -1
- package/dist/common/ResourcesErrors.js +8 -30
- package/dist/common/ResourcesErrors.js.map +1 -1
- package/dist/common/statuses.d.ts +41 -0
- package/dist/common/statuses.d.ts.map +1 -1
- package/dist/common/statuses.js +46 -21
- package/dist/common/statuses.js.map +1 -1
- package/dist/components/AbstractObject.d.ts +1 -1
- package/dist/components/AbstractObject.d.ts.map +1 -1
- package/dist/components/ObjectUri.d.ts +1 -34
- package/dist/components/ObjectUri.d.ts.map +1 -1
- package/dist/components/ObjectUri.js +2 -126
- package/dist/components/ObjectUri.js.map +1 -1
- package/dist/components/types/BaseObjectType.d.ts +1 -10
- package/dist/components/types/BaseObjectType.d.ts.map +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/common/ResourcesErrors.ts +9 -38
- package/src/common/statuses.test.ts +70 -0
- package/src/common/statuses.ts +50 -20
- package/src/components/ObjectUri.ts +1 -188
- package/src/components/types/BaseObjectType.ts +1 -10
- package/src/index.ts +8 -6
- package/src/properties/DateTimeProperty.test.ts +91 -0
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
constructor(message: string);
|
|
3
|
-
}
|
|
4
|
-
export declare class BadRequestError extends ResourceError {
|
|
5
|
-
}
|
|
6
|
-
export declare class UnauthorizedError extends ResourceError {
|
|
7
|
-
}
|
|
8
|
-
export declare class ForbiddenError extends ResourceError {
|
|
9
|
-
}
|
|
10
|
-
export declare class NotFoundError extends ResourceError {
|
|
11
|
-
}
|
|
12
|
-
export declare class GoneError extends ResourceError {
|
|
13
|
-
}
|
|
14
|
-
export declare class ValidationError extends ResourceError {
|
|
15
|
-
errors: Record<string, string>;
|
|
16
|
-
constructor(message: string, errors?: Record<string, string>);
|
|
17
|
-
}
|
|
1
|
+
export { ResourceError, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError, ValidationError, } from '@quatrain/types';
|
|
18
2
|
//# sourceMappingURL=ResourcesErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcesErrors.d.ts","sourceRoot":"","sources":["../../src/common/ResourcesErrors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResourcesErrors.d.ts","sourceRoot":"","sources":["../../src/common/ResourcesErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EACJ,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,GACjB,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ValidationError = exports.GoneError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.BadRequestError = exports.ResourceError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
exports.
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
exports.BadRequestError = BadRequestError;
|
|
14
|
-
class UnauthorizedError extends ResourceError {
|
|
15
|
-
}
|
|
16
|
-
exports.UnauthorizedError = UnauthorizedError;
|
|
17
|
-
class ForbiddenError extends ResourceError {
|
|
18
|
-
}
|
|
19
|
-
exports.ForbiddenError = ForbiddenError;
|
|
20
|
-
class NotFoundError extends ResourceError {
|
|
21
|
-
}
|
|
22
|
-
exports.NotFoundError = NotFoundError;
|
|
23
|
-
class GoneError extends ResourceError {
|
|
24
|
-
}
|
|
25
|
-
exports.GoneError = GoneError;
|
|
26
|
-
class ValidationError extends ResourceError {
|
|
27
|
-
errors;
|
|
28
|
-
constructor(message, errors = {}) {
|
|
29
|
-
super(message);
|
|
30
|
-
this.errors = errors;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.ValidationError = ValidationError;
|
|
4
|
+
var types_1 = require("@quatrain/types");
|
|
5
|
+
Object.defineProperty(exports, "ResourceError", { enumerable: true, get: function () { return types_1.ResourceError; } });
|
|
6
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return types_1.BadRequestError; } });
|
|
7
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return types_1.UnauthorizedError; } });
|
|
8
|
+
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return types_1.ForbiddenError; } });
|
|
9
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return types_1.NotFoundError; } });
|
|
10
|
+
Object.defineProperty(exports, "GoneError", { enumerable: true, get: function () { return types_1.GoneError; } });
|
|
11
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return types_1.ValidationError; } });
|
|
34
12
|
//# sourceMappingURL=ResourcesErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcesErrors.js","sourceRoot":"","sources":["../../src/common/ResourcesErrors.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ResourcesErrors.js","sourceRoot":"","sources":["../../src/common/ResourcesErrors.ts"],"names":[],"mappings":";;;AAAA,yCAQwB;AAPrB,sGAAA,aAAa,OAAA;AACb,wGAAA,eAAe,OAAA;AACf,0GAAA,iBAAiB,OAAA;AACjB,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AACb,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA"}
|
|
@@ -1,21 +1,62 @@
|
|
|
1
1
|
export declare const ACTIVE = "active";
|
|
2
|
+
export declare const APPROVED = "approved";
|
|
3
|
+
export declare const ARCHIVED = "archived";
|
|
4
|
+
export declare const BLOCKED = "blocked";
|
|
5
|
+
export declare const CANCELLED = "cancelled";
|
|
2
6
|
export declare const COMPLETED = "completed";
|
|
7
|
+
export declare const CONVERTING = "converting";
|
|
3
8
|
export declare const CREATED = "created";
|
|
4
9
|
export declare const DELETABLE = "deletable";
|
|
5
10
|
export declare const DELETED = "deleted";
|
|
6
11
|
export declare const DISABLED = "disabled";
|
|
7
12
|
export declare const DONE = "done";
|
|
13
|
+
export declare const DRAFT = "draft";
|
|
8
14
|
export declare const DOWNLOADING = "downloading";
|
|
9
15
|
export declare const DOWNLOADED = "downloaded";
|
|
10
16
|
export declare const DOWNLOAD_KO = "download_ko";
|
|
11
17
|
export declare const ERROR = "error";
|
|
18
|
+
export declare const EXPIRED = "expired";
|
|
19
|
+
export declare const FAILED = "failed";
|
|
20
|
+
export declare const GENERATING = "generating";
|
|
21
|
+
export declare const GENERATED = "generated";
|
|
22
|
+
export declare const IN_PROGRESS = "in_progress";
|
|
12
23
|
export declare const KO = "ko";
|
|
24
|
+
export declare const OK = "ok";
|
|
25
|
+
export declare const PAUSED = "paused";
|
|
13
26
|
export declare const PENDING = "pending";
|
|
14
27
|
export declare const PREPARING = "preparing";
|
|
15
28
|
export declare const PROCESSING = "processing";
|
|
29
|
+
export declare const PUBLISHED = "published";
|
|
16
30
|
export declare const QUEUED = "queued";
|
|
31
|
+
export declare const REJECTED = "rejected";
|
|
32
|
+
export declare const RUNNING = "running";
|
|
33
|
+
export declare const SUCCESS = "success";
|
|
34
|
+
export declare const SUSPENDED = "suspended";
|
|
17
35
|
export declare const UNKNOWN = "unknown";
|
|
36
|
+
export declare const UPDATED = "updated";
|
|
18
37
|
export declare const UPLOADING = "uploading";
|
|
19
38
|
export declare const UPLOADED = "uploaded";
|
|
20
39
|
export declare const UPLOAD_KO = "upload_ko";
|
|
40
|
+
export declare const VALIDATED = "validated";
|
|
41
|
+
export declare const ZIPPING = "zipping";
|
|
42
|
+
export declare const DOWNLOAD: {
|
|
43
|
+
readonly STARTED: "downloading";
|
|
44
|
+
readonly FINISHED: "downloaded";
|
|
45
|
+
readonly OK: "downloaded";
|
|
46
|
+
readonly KO: "download_ko";
|
|
47
|
+
};
|
|
48
|
+
export declare const UPLOAD: {
|
|
49
|
+
readonly STARTED: "uploading";
|
|
50
|
+
readonly FINISHED: "uploaded";
|
|
51
|
+
readonly OK: "uploaded";
|
|
52
|
+
readonly KO: "upload_ko";
|
|
53
|
+
};
|
|
54
|
+
export declare const DOCUMENT: {
|
|
55
|
+
readonly DRAFT: "draft";
|
|
56
|
+
readonly PENDING: "pending";
|
|
57
|
+
readonly APPROVED: "approved";
|
|
58
|
+
readonly REJECTED: "rejected";
|
|
59
|
+
readonly PUBLISHED: "published";
|
|
60
|
+
readonly ARCHIVED: "archived";
|
|
61
|
+
};
|
|
21
62
|
//# sourceMappingURL=statuses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statuses.d.ts","sourceRoot":"","sources":["../../src/common/statuses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statuses.d.ts","sourceRoot":"","sources":["../../src/common/statuses.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,WAAkB,CAAA;AACrC,eAAO,MAAM,QAAQ,aAAoB,CAAA;AACzC,eAAO,MAAM,QAAQ,aAAoB,CAAA;AACzC,eAAO,MAAM,OAAO,YAAmB,CAAA;AACvC,eAAO,MAAM,SAAS,cAAqB,CAAA;AAC3C,eAAO,MAAM,SAAS,cAAqB,CAAA;AAC3C,eAAO,MAAM,UAAU,eAAsB,CAAA;AAC7C,eAAO,MAAM,OAAO,YAAmB,CAAA;AACvC,eAAO,MAAM,SAAS,cAAqB,CAAA;AAC3C,eAAO,MAAM,OAAO,YAAmB,CAAA;AACvC,eAAO,MAAM,QAAQ,aAAoB,CAAA;AACzC,eAAO,MAAM,IAAI,SAAgB,CAAA;AACjC,eAAO,MAAM,KAAK,UAAiB,CAAA;AACnC,eAAO,MAAM,WAAW,gBA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|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UPLOAD_KO = exports.UPLOADED = exports.UPLOADING = exports.UNKNOWN = exports.QUEUED = exports.PROCESSING = exports.PREPARING = exports.PENDING = exports.KO = exports.ERROR = exports.DOWNLOAD_KO = exports.DOWNLOADED = exports.DOWNLOADING = exports.DONE = exports.DISABLED = exports.DELETED = exports.DELETABLE = exports.CREATED = exports.COMPLETED = exports.ACTIVE = void 0;
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
3
|
+
exports.DOCUMENT = exports.UPLOAD = exports.DOWNLOAD = exports.ZIPPING = exports.VALIDATED = exports.UPLOAD_KO = exports.UPLOADED = exports.UPLOADING = exports.UPDATED = exports.UNKNOWN = exports.SUSPENDED = exports.SUCCESS = exports.RUNNING = exports.REJECTED = exports.QUEUED = exports.PUBLISHED = exports.PROCESSING = exports.PREPARING = exports.PENDING = exports.PAUSED = exports.OK = exports.KO = exports.IN_PROGRESS = exports.GENERATED = exports.GENERATING = exports.FAILED = exports.EXPIRED = exports.ERROR = exports.DOWNLOAD_KO = exports.DOWNLOADED = exports.DOWNLOADING = exports.DRAFT = exports.DONE = exports.DISABLED = exports.DELETED = exports.DELETABLE = exports.CREATED = exports.CONVERTING = exports.COMPLETED = exports.CANCELLED = exports.BLOCKED = exports.ARCHIVED = exports.APPROVED = exports.ACTIVE = void 0;
|
|
4
|
+
const types_1 = require("@quatrain/types");
|
|
5
|
+
exports.ACTIVE = types_1.statuses.ACTIVE;
|
|
6
|
+
exports.APPROVED = types_1.statuses.APPROVED;
|
|
7
|
+
exports.ARCHIVED = types_1.statuses.ARCHIVED;
|
|
8
|
+
exports.BLOCKED = types_1.statuses.BLOCKED;
|
|
9
|
+
exports.CANCELLED = types_1.statuses.CANCELLED;
|
|
10
|
+
exports.COMPLETED = types_1.statuses.COMPLETED;
|
|
11
|
+
exports.CONVERTING = types_1.statuses.CONVERTING;
|
|
12
|
+
exports.CREATED = types_1.statuses.CREATED;
|
|
13
|
+
exports.DELETABLE = types_1.statuses.DELETABLE;
|
|
14
|
+
exports.DELETED = types_1.statuses.DELETED;
|
|
15
|
+
exports.DISABLED = types_1.statuses.DISABLED;
|
|
16
|
+
exports.DONE = types_1.statuses.DONE;
|
|
17
|
+
exports.DRAFT = types_1.statuses.DRAFT;
|
|
18
|
+
exports.DOWNLOADING = types_1.statuses.DOWNLOADING;
|
|
19
|
+
exports.DOWNLOADED = types_1.statuses.DOWNLOADED;
|
|
20
|
+
exports.DOWNLOAD_KO = types_1.statuses.DOWNLOAD_KO;
|
|
21
|
+
exports.ERROR = types_1.statuses.ERROR;
|
|
22
|
+
exports.EXPIRED = types_1.statuses.EXPIRED;
|
|
23
|
+
exports.FAILED = types_1.statuses.FAILED;
|
|
24
|
+
exports.GENERATING = types_1.statuses.GENERATING;
|
|
25
|
+
exports.GENERATED = types_1.statuses.GENERATED;
|
|
26
|
+
exports.IN_PROGRESS = types_1.statuses.IN_PROGRESS;
|
|
27
|
+
exports.KO = types_1.statuses.KO;
|
|
28
|
+
exports.OK = types_1.statuses.OK;
|
|
29
|
+
exports.PAUSED = types_1.statuses.PAUSED;
|
|
30
|
+
exports.PENDING = types_1.statuses.PENDING;
|
|
31
|
+
exports.PREPARING = types_1.statuses.PREPARING;
|
|
32
|
+
exports.PROCESSING = types_1.statuses.PROCESSING;
|
|
33
|
+
exports.PUBLISHED = types_1.statuses.PUBLISHED;
|
|
34
|
+
exports.QUEUED = types_1.statuses.QUEUED;
|
|
35
|
+
exports.REJECTED = types_1.statuses.REJECTED;
|
|
36
|
+
exports.RUNNING = types_1.statuses.RUNNING;
|
|
37
|
+
exports.SUCCESS = types_1.statuses.SUCCESS;
|
|
38
|
+
exports.SUSPENDED = types_1.statuses.SUSPENDED;
|
|
39
|
+
exports.UNKNOWN = types_1.statuses.UNKNOWN;
|
|
40
|
+
exports.UPDATED = types_1.statuses.UPDATED;
|
|
41
|
+
exports.UPLOADING = types_1.statuses.UPLOADING;
|
|
42
|
+
exports.UPLOADED = types_1.statuses.UPLOADED;
|
|
43
|
+
exports.UPLOAD_KO = types_1.statuses.UPLOAD_KO;
|
|
44
|
+
exports.VALIDATED = types_1.statuses.VALIDATED;
|
|
45
|
+
exports.ZIPPING = types_1.statuses.ZIPPING;
|
|
46
|
+
exports.DOWNLOAD = types_1.statuses.DOWNLOAD;
|
|
47
|
+
exports.UPLOAD = types_1.statuses.UPLOAD;
|
|
48
|
+
exports.DOCUMENT = types_1.statuses.DOCUMENT;
|
|
24
49
|
//# sourceMappingURL=statuses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statuses.js","sourceRoot":"","sources":["../../src/common/statuses.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"statuses.js","sourceRoot":"","sources":["../../src/common/statuses.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAE7B,QAAA,MAAM,GAAG,gBAAQ,CAAC,MAAM,CAAA;AACxB,QAAA,QAAQ,GAAG,gBAAQ,CAAC,QAAQ,CAAA;AAC5B,QAAA,QAAQ,GAAG,gBAAQ,CAAC,QAAQ,CAAA;AAC5B,QAAA,OAAO,GAAG,gBAAQ,CAAC,OAAO,CAAA;AAC1B,QAAA,SAAS,GAAG,gBAAQ,CAAC,SAAS,CAAA;AAC9B,QAAA,SAAS,GAAG,gBAAQ,CAAC,SAAS,CAAA;AAC9B,QAAA,UAAU,GAAG,gBAAQ,CAAC,UAAU,CAAA;AAChC,QAAA,OA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,GAAG,gBAAQ,CAAC,OAAO,CAAA;AAC1B,QAAA,OAAO,GAAG,gBAAQ,CAAC,OAAO,CAAA;AAC1B,QAAA,SAAS,GAAG,gBAAQ,CAAC,SAAS,CAAA;AAC9B,QAAA,OAAO,GAAG,gBAAQ,CAAC,OAAO,CAAA;AAC1B,QAAA,OAAO,GAAG,gBAAQ,CAAC,OAAO,CAAA;AAC1B,QAAA,SAAS,GAAG,gBAAQ,CAAC,SAAS,CAAA;AAC9B,QAAA,QAAQ,GAAG,gBAAQ,CAAC,QAAQ,CAAA;AAC5B,QAAA,SAAS,GAAG,gBAAQ,CAAC,SAAS,CAAA;AAC9B,QAAA,SAAS,GAAG,gBAAQ,CAAC,SAAS,CAAA;AAC9B,QAAA,OAAO,GAAG,gBAAQ,CAAC,OAAO,CAAA;AAE1B,QAAA,QAAQ,GAAG,gBAAQ,CAAC,QAAQ,CAAA;AAC5B,QAAA,MAAM,GAAG,gBAAQ,CAAC,MAAM,CAAA;AACxB,QAAA,QAAQ,GAAG,gBAAQ,CAAC,QAAQ,CAAA"}
|
|
@@ -15,7 +15,7 @@ export declare abstract class AbstractObject {
|
|
|
15
15
|
get uid(): any;
|
|
16
16
|
get dataObject(): DataObjectClass<any>;
|
|
17
17
|
get _(): any;
|
|
18
|
-
get uri(): import("
|
|
18
|
+
get uri(): import("packages/types/dist").ObjectUri;
|
|
19
19
|
toJSON(): any;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=AbstractObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractObject.d.ts","sourceRoot":"","sources":["../../src/components/AbstractObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAKpD,8BAAsB,cAAc;IAEjC,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAK;IAGlD,MAAM,CAAC,UAAU,E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AI,IAAI,MAAM,CAEjB;IAED,IAAI,GAAG,QAEN;IAED,IAAI,UAAU,yBAEb;IAED,IAAI,CAAC,QAEJ;IAED,IAAI,GAAG,4CAEN;IAOD,MAAM;CAGR"}
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
static DEFAULT: string;
|
|
3
|
-
static MISSING_COLLECTION: string;
|
|
4
|
-
protected _str: string;
|
|
5
|
-
protected _pairs: Array<string>;
|
|
6
|
-
protected _literal: string;
|
|
7
|
-
protected _backend: string | undefined;
|
|
8
|
-
protected _path: string;
|
|
9
|
-
protected _uid: string | undefined;
|
|
10
|
-
protected _collection: string | undefined;
|
|
11
|
-
protected _label: string | undefined;
|
|
12
|
-
protected _objClass: any;
|
|
13
|
-
protected _parent: ObjectUri | undefined;
|
|
14
|
-
constructor(str?: string, label?: string | undefined);
|
|
15
|
-
set class(objClass: any);
|
|
16
|
-
get class(): any;
|
|
17
|
-
get backend(): string | undefined;
|
|
18
|
-
get path(): string;
|
|
19
|
-
get ownPath(): string;
|
|
20
|
-
get parent(): ObjectUri | undefined;
|
|
21
|
-
set label(label: string | undefined);
|
|
22
|
-
get label(): string | undefined;
|
|
23
|
-
get literal(): string;
|
|
24
|
-
set path(path: string);
|
|
25
|
-
get uid(): string | undefined;
|
|
26
|
-
get collection(): string | undefined;
|
|
27
|
-
set collection(collection: string | undefined);
|
|
28
|
-
toReference(): {
|
|
29
|
-
ref: string;
|
|
30
|
-
uri: string;
|
|
31
|
-
label: string | undefined;
|
|
32
|
-
};
|
|
33
|
-
toJSON(): any;
|
|
34
|
-
}
|
|
1
|
+
export { ObjectUri } from '@quatrain/types';
|
|
35
2
|
//# sourceMappingURL=ObjectUri.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectUri.d.ts","sourceRoot":"","sources":["../../src/components/ObjectUri.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObjectUri.d.ts","sourceRoot":"","sources":["../../src/components/ObjectUri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,130 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectUri = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
static MISSING_COLLECTION = '_?_';
|
|
7
|
-
_str;
|
|
8
|
-
_pairs = [];
|
|
9
|
-
_literal = '';
|
|
10
|
-
_backend;
|
|
11
|
-
_path = ObjectUri.DEFAULT;
|
|
12
|
-
_uid = undefined;
|
|
13
|
-
_collection = undefined;
|
|
14
|
-
_label = '';
|
|
15
|
-
_objClass;
|
|
16
|
-
_parent;
|
|
17
|
-
constructor(str = '', label = '') {
|
|
18
|
-
this._str = str;
|
|
19
|
-
this._label = label;
|
|
20
|
-
if (str.includes(':')) {
|
|
21
|
-
const [backend, path] = str.split(':');
|
|
22
|
-
this._backend = backend;
|
|
23
|
-
this._path = path;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this._path = str;
|
|
27
|
-
}
|
|
28
|
-
const parts = this._path.split(ObjectUri.DEFAULT);
|
|
29
|
-
const isFilePath = parts[parts.length - 1].indexOf('.') !== -1;
|
|
30
|
-
if (isFilePath) {
|
|
31
|
-
this._uid = parts[parts.length - 1];
|
|
32
|
-
}
|
|
33
|
-
else if (parts.length === 1) {
|
|
34
|
-
this._uid = parts[0].length > 0 ? parts[0] : undefined;
|
|
35
|
-
this._collection = ObjectUri.MISSING_COLLECTION;
|
|
36
|
-
this._pairs.push(`${ObjectUri.MISSING_COLLECTION}${ObjectUri.DEFAULT}${this._uid}`);
|
|
37
|
-
this._label = label || this._uid;
|
|
38
|
-
}
|
|
39
|
-
else if (parts.length % 2 === 0) {
|
|
40
|
-
this._path = parts.slice(parts.length - 2).join(ObjectUri.DEFAULT);
|
|
41
|
-
this._uid = parts[parts.length - 1];
|
|
42
|
-
this._collection = parts[parts.length - 2];
|
|
43
|
-
if (parts.length > 2) {
|
|
44
|
-
this._parent = new ObjectUri(parts.slice(0, parts.length - 2).join(ObjectUri.DEFAULT));
|
|
45
|
-
}
|
|
46
|
-
this._label = label || this._uid;
|
|
47
|
-
}
|
|
48
|
-
else if (!isFilePath) {
|
|
49
|
-
throw new Error(`Path parts number must be 1 or even, received: '${str}'`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
set class(objClass) {
|
|
53
|
-
this._objClass = objClass;
|
|
54
|
-
if (objClass) {
|
|
55
|
-
this._collection =
|
|
56
|
-
objClass.COLLECTION ||
|
|
57
|
-
(objClass.name && objClass.name.toLowerCase());
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
this._collection = undefined;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
get class() {
|
|
64
|
-
return this._objClass;
|
|
65
|
-
}
|
|
66
|
-
get backend() {
|
|
67
|
-
return this._backend;
|
|
68
|
-
}
|
|
69
|
-
get path() {
|
|
70
|
-
return this._parent
|
|
71
|
-
? `${this._parent.path}${ObjectUri.DEFAULT}${this._path}`
|
|
72
|
-
: this._path;
|
|
73
|
-
}
|
|
74
|
-
get ownPath() {
|
|
75
|
-
return this._path;
|
|
76
|
-
}
|
|
77
|
-
get parent() {
|
|
78
|
-
return this._parent;
|
|
79
|
-
}
|
|
80
|
-
set label(label) {
|
|
81
|
-
this._label = label;
|
|
82
|
-
}
|
|
83
|
-
get label() {
|
|
84
|
-
return this._label;
|
|
85
|
-
}
|
|
86
|
-
get literal() {
|
|
87
|
-
return this._str.includes(':')
|
|
88
|
-
? this._str
|
|
89
|
-
: `${this._backend}:${this._str}`;
|
|
90
|
-
}
|
|
91
|
-
set path(path) {
|
|
92
|
-
this._path = path;
|
|
93
|
-
this._collection = path.split('/')[0];
|
|
94
|
-
this._literal = `${this._backend}:${this._path}`;
|
|
95
|
-
this._uid = path.split('/').pop();
|
|
96
|
-
}
|
|
97
|
-
get uid() {
|
|
98
|
-
return this._uid;
|
|
99
|
-
}
|
|
100
|
-
get collection() {
|
|
101
|
-
return this._collection === ObjectUri.MISSING_COLLECTION
|
|
102
|
-
? undefined
|
|
103
|
-
: this._collection;
|
|
104
|
-
}
|
|
105
|
-
set collection(collection) {
|
|
106
|
-
if (this.collection !== undefined) {
|
|
107
|
-
throw new Error('Collection value already set');
|
|
108
|
-
}
|
|
109
|
-
this._collection = collection;
|
|
110
|
-
}
|
|
111
|
-
toReference() {
|
|
112
|
-
return {
|
|
113
|
-
ref: this.path,
|
|
114
|
-
uri: this._literal,
|
|
115
|
-
label: this._label,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
toJSON() {
|
|
119
|
-
const res = {
|
|
120
|
-
ref: this.path,
|
|
121
|
-
label: this._label || '',
|
|
122
|
-
};
|
|
123
|
-
if (this._backend !== undefined) {
|
|
124
|
-
res.backend = this._backend;
|
|
125
|
-
}
|
|
126
|
-
return res;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.ObjectUri = ObjectUri;
|
|
4
|
+
var types_1 = require("@quatrain/types");
|
|
5
|
+
Object.defineProperty(exports, "ObjectUri", { enumerable: true, get: function () { return types_1.ObjectUri; } });
|
|
130
6
|
//# sourceMappingURL=ObjectUri.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectUri.js","sourceRoot":"","sources":["../../src/components/ObjectUri.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ObjectUri.js","sourceRoot":"","sources":["../../src/components/ObjectUri.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAAlC,kGAAA,SAAS,OAAA"}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
name: string;
|
|
3
|
-
status?: string;
|
|
4
|
-
createdBy?: any;
|
|
5
|
-
createdAt?: number | string;
|
|
6
|
-
updatedBy?: any;
|
|
7
|
-
updatedAt?: number | string;
|
|
8
|
-
deletedBy?: any;
|
|
9
|
-
deletedAt?: number | string;
|
|
10
|
-
}
|
|
1
|
+
export type { BaseObjectType } from '@quatrain/types';
|
|
11
2
|
//# sourceMappingURL=BaseObjectType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseObjectType.d.ts","sourceRoot":"","sources":["../../../src/components/types/BaseObjectType.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"BaseObjectType.d.ts","sourceRoot":"","sources":["../../../src/components/types/BaseObjectType.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Core } from './Core';
|
|
2
|
-
import * as statuses from './common/statuses';
|
|
3
2
|
import { Property } from './properties/Property';
|
|
4
3
|
import { BaseProperty, BasePropertyType } from './properties/BaseProperty';
|
|
5
4
|
import { StringProperty, StringPropertyType } from './properties/StringProperty';
|
|
@@ -14,19 +13,17 @@ import { ArrayProperty, ArrayPropertyType } from './properties/ArrayProperty';
|
|
|
14
13
|
import { MapProperty, MapPropertyType } from './properties/MapProperty';
|
|
15
14
|
import { FileProperty, FilePropertyType } from './properties/FileProperty';
|
|
16
15
|
import { AbstractObject } from './components/AbstractObject';
|
|
17
|
-
import { ObjectUri } from './components/ObjectUri';
|
|
18
16
|
import { DataObjectClass } from './components/types/DataObjectClass';
|
|
19
17
|
import { DataObject } from './components/DataObject';
|
|
20
18
|
import { DataObjectProperties } from './properties';
|
|
21
19
|
import { BaseObject } from './components/BaseObject';
|
|
22
20
|
import { BaseObjectProperties } from './components/BaseObjectProperties';
|
|
23
|
-
import { BaseObjectType } from './components/types/BaseObjectType';
|
|
24
21
|
import { Proxy } from './components/types/ProxyConstructor';
|
|
25
22
|
import { UserType, User, UserProperties } from './components/User';
|
|
26
23
|
import { EntityType, Entity } from './components/Entity';
|
|
27
|
-
import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError, ValidationError } from './common/ResourcesErrors';
|
|
28
24
|
import * as htmlType from './properties/types/PropertyHTMLType';
|
|
29
25
|
import { DataObjectParams } from './components/types/DataObjectParams';
|
|
26
|
+
import { ObjectUri, statuses, BaseObjectType, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError, ValidationError } from '@quatrain/types';
|
|
30
27
|
export { htmlType, statuses, Core, Property, BaseProperty, BooleanProperty, DateTimeProperty, EnumProperty, HashProperty, CollectionProperty, ArrayProperty, ObjectProperty, NumberProperty, returnAs, StringProperty, MapProperty, FileProperty, ObjectUri, DataObject, AbstractObject, BaseObject, BaseObjectProperties, User, UserProperties, Entity, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError, ValidationError, };
|
|
31
28
|
export type { BasePropertyType, BooleanPropertyType, DataObjectParams, DateTimePropertyType, EnumPropertyType, HashPropertyType, CollectionPropertyType, ArrayPropertyType, ObjectPropertyType, NumberPropertyType, StringPropertyType, MapPropertyType, FilePropertyType, DataObjectClass, DataObjectProperties, BaseObjectType, UserType, Proxy, EntityType, };
|
|
32
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChF,O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AE,MAAM,qCAAqC,CAAA;AAGtE,OAAO,EACJ,SAAS,EACT,QAAQ,EACR,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACJ,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACd,QAAQ,EACR,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,IAAI,EACJ,cAAc,EACd,MAAM,EACN,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,GACjB,CAAA;AAED,YAAY,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,KAAK,EACL,UAAU,GACZ,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -36,8 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.ValidationError = exports.GoneError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.BadRequestError = exports.Entity = exports.UserProperties = exports.User = exports.BaseObjectProperties = exports.BaseObject = exports.AbstractObject = exports.DataObject = exports.ObjectUri = exports.FileProperty = exports.MapProperty = exports.StringProperty = exports.returnAs = exports.NumberProperty = exports.ObjectProperty = exports.ArrayProperty = exports.CollectionProperty = exports.HashProperty = exports.EnumProperty = exports.DateTimeProperty = exports.BooleanProperty = exports.BaseProperty = exports.Property = exports.Core = exports.statuses = exports.htmlType = void 0;
|
|
37
37
|
const Core_1 = require("./Core");
|
|
38
38
|
Object.defineProperty(exports, "Core", { enumerable: true, get: function () { return Core_1.Core; } });
|
|
39
|
-
const statuses = __importStar(require("./common/statuses"));
|
|
40
|
-
exports.statuses = statuses;
|
|
41
39
|
const Property_1 = require("./properties/Property");
|
|
42
40
|
Object.defineProperty(exports, "Property", { enumerable: true, get: function () { return Property_1.Property; } });
|
|
43
41
|
const BaseProperty_1 = require("./properties/BaseProperty");
|
|
@@ -67,8 +65,6 @@ const FileProperty_1 = require("./properties/FileProperty");
|
|
|
67
65
|
Object.defineProperty(exports, "FileProperty", { enumerable: true, get: function () { return FileProperty_1.FileProperty; } });
|
|
68
66
|
const AbstractObject_1 = require("./components/AbstractObject");
|
|
69
67
|
Object.defineProperty(exports, "AbstractObject", { enumerable: true, get: function () { return AbstractObject_1.AbstractObject; } });
|
|
70
|
-
const ObjectUri_1 = require("./components/ObjectUri");
|
|
71
|
-
Object.defineProperty(exports, "ObjectUri", { enumerable: true, get: function () { return ObjectUri_1.ObjectUri; } });
|
|
72
68
|
const DataObject_1 = require("./components/DataObject");
|
|
73
69
|
Object.defineProperty(exports, "DataObject", { enumerable: true, get: function () { return DataObject_1.DataObject; } });
|
|
74
70
|
const BaseObject_1 = require("./components/BaseObject");
|
|
@@ -80,13 +76,15 @@ Object.defineProperty(exports, "User", { enumerable: true, get: function () { re
|
|
|
80
76
|
Object.defineProperty(exports, "UserProperties", { enumerable: true, get: function () { return User_1.UserProperties; } });
|
|
81
77
|
const Entity_1 = require("./components/Entity");
|
|
82
78
|
Object.defineProperty(exports, "Entity", { enumerable: true, get: function () { return Entity_1.Entity; } });
|
|
83
|
-
const ResourcesErrors_1 = require("./common/ResourcesErrors");
|
|
84
|
-
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return ResourcesErrors_1.BadRequestError; } });
|
|
85
|
-
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return ResourcesErrors_1.UnauthorizedError; } });
|
|
86
|
-
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return ResourcesErrors_1.ForbiddenError; } });
|
|
87
|
-
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return ResourcesErrors_1.NotFoundError; } });
|
|
88
|
-
Object.defineProperty(exports, "GoneError", { enumerable: true, get: function () { return ResourcesErrors_1.GoneError; } });
|
|
89
|
-
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return ResourcesErrors_1.ValidationError; } });
|
|
90
79
|
const htmlType = __importStar(require("./properties/types/PropertyHTMLType"));
|
|
91
80
|
exports.htmlType = htmlType;
|
|
81
|
+
const types_1 = require("@quatrain/types");
|
|
82
|
+
Object.defineProperty(exports, "ObjectUri", { enumerable: true, get: function () { return types_1.ObjectUri; } });
|
|
83
|
+
Object.defineProperty(exports, "statuses", { enumerable: true, get: function () { return types_1.statuses; } });
|
|
84
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return types_1.BadRequestError; } });
|
|
85
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return types_1.UnauthorizedError; } });
|
|
86
|
+
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return types_1.ForbiddenError; } });
|
|
87
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return types_1.NotFoundError; } });
|
|
88
|
+
Object.defineProperty(exports, "GoneError", { enumerable: true, get: function () { return types_1.GoneError; } });
|
|
89
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return types_1.ValidationError; } });
|
|
92
90
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA6B;
|
|
1
|
+
{"version":3,"file":"index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,OAkCA;AACf,kGAlCA,yBAAiB,OAkCA;AACjB,+FAlCA,sBAAc,OAkCA;AACd,8FAlCA,qBAAa,OAkCA;AACb,0FAlCA,iBAAS,OAkCA;AACT,gGAlCA,uBAAe,OAkCA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "Core objects for business apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"author": "Quatrain Développement SAS <developers@quatrain.com>",
|
|
21
21
|
"license": "AGPL-3.0-only",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@quatrain/testing": "^1.1.4",
|
|
24
23
|
"@tsconfig/recommended": "^1.0.1",
|
|
25
24
|
"@types/jest": "^29.5.12",
|
|
26
25
|
"@types/node": "^22.10.1",
|
|
@@ -34,6 +33,7 @@
|
|
|
34
33
|
},
|
|
35
34
|
"dependencies": {
|
|
36
35
|
"@quatrain/log": "^1.2.3",
|
|
36
|
+
"@quatrain/types": "^1.2.13",
|
|
37
37
|
"node-persist": "^4.0.4",
|
|
38
38
|
"which": "^5.0.0"
|
|
39
39
|
},
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** Indicates a structurally flawed request (e.g., HTTP 400). */
|
|
13
|
-
export class BadRequestError extends ResourceError {}
|
|
14
|
-
|
|
15
|
-
/** Indicates missing or invalid authentication credentials (e.g., HTTP 401). */
|
|
16
|
-
export class UnauthorizedError extends ResourceError {}
|
|
17
|
-
|
|
18
|
-
/** Indicates an authenticated action denied by privileges (e.g., HTTP 403). */
|
|
19
|
-
export class ForbiddenError extends ResourceError {}
|
|
20
|
-
|
|
21
|
-
/** Indicates a non-existent database or file resource lookup (e.g., HTTP 404). */
|
|
22
|
-
export class NotFoundError extends ResourceError {}
|
|
23
|
-
|
|
24
|
-
/** Indicates an originally valid asset that has been purged (e.g., HTTP 410). */
|
|
25
|
-
export class GoneError extends ResourceError {}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Indicates property rejection. Holds a payload of granular property-specific validation issues.
|
|
29
|
-
*/
|
|
30
|
-
export class ValidationError extends ResourceError {
|
|
31
|
-
/** Detailed key-value map linking property names to specific violation causes. */
|
|
32
|
-
public errors: Record<string, string>
|
|
33
|
-
|
|
34
|
-
constructor(message: string, errors: Record<string, string> = {}) {
|
|
35
|
-
super(message)
|
|
36
|
-
this.errors = errors
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
export {
|
|
2
|
+
ResourceError,
|
|
3
|
+
BadRequestError,
|
|
4
|
+
UnauthorizedError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
GoneError,
|
|
8
|
+
ValidationError,
|
|
9
|
+
} from '@quatrain/types'
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as statuses from './statuses'
|
|
2
|
+
|
|
3
|
+
describe('Core Statuses', () => {
|
|
4
|
+
it('should export all expected standard and complementary statuses as correct strings', () => {
|
|
5
|
+
expect(statuses.ACTIVE).toBe('active')
|
|
6
|
+
expect(statuses.APPROVED).toBe('approved')
|
|
7
|
+
expect(statuses.ARCHIVED).toBe('archived')
|
|
8
|
+
expect(statuses.BLOCKED).toBe('blocked')
|
|
9
|
+
expect(statuses.CANCELLED).toBe('cancelled')
|
|
10
|
+
expect(statuses.COMPLETED).toBe('completed')
|
|
11
|
+
expect(statuses.CONVERTING).toBe('converting')
|
|
12
|
+
expect(statuses.CREATED).toBe('created')
|
|
13
|
+
expect(statuses.DELETABLE).toBe('deletable')
|
|
14
|
+
expect(statuses.DELETED).toBe('deleted')
|
|
15
|
+
expect(statuses.DISABLED).toBe('disabled')
|
|
16
|
+
expect(statuses.DONE).toBe('done')
|
|
17
|
+
expect(statuses.DRAFT).toBe('draft')
|
|
18
|
+
expect(statuses.DOWNLOADING).toBe('downloading')
|
|
19
|
+
expect(statuses.DOWNLOADED).toBe('downloaded')
|
|
20
|
+
expect(statuses.DOWNLOAD_KO).toBe('download_ko')
|
|
21
|
+
expect(statuses.ERROR).toBe('error')
|
|
22
|
+
expect(statuses.EXPIRED).toBe('expired')
|
|
23
|
+
expect(statuses.FAILED).toBe('failed')
|
|
24
|
+
expect(statuses.GENERATING).toBe('generating')
|
|
25
|
+
expect(statuses.GENERATED).toBe('generated')
|
|
26
|
+
expect(statuses.IN_PROGRESS).toBe('in_progress')
|
|
27
|
+
expect(statuses.KO).toBe('ko')
|
|
28
|
+
expect(statuses.OK).toBe('ok')
|
|
29
|
+
expect(statuses.PAUSED).toBe('paused')
|
|
30
|
+
expect(statuses.PENDING).toBe('pending')
|
|
31
|
+
expect(statuses.PREPARING).toBe('preparing')
|
|
32
|
+
expect(statuses.PROCESSING).toBe('processing')
|
|
33
|
+
expect(statuses.PUBLISHED).toBe('published')
|
|
34
|
+
expect(statuses.QUEUED).toBe('queued')
|
|
35
|
+
expect(statuses.REJECTED).toBe('rejected')
|
|
36
|
+
expect(statuses.RUNNING).toBe('running')
|
|
37
|
+
expect(statuses.SUCCESS).toBe('success')
|
|
38
|
+
expect(statuses.SUSPENDED).toBe('suspended')
|
|
39
|
+
expect(statuses.UNKNOWN).toBe('unknown')
|
|
40
|
+
expect(statuses.UPDATED).toBe('updated')
|
|
41
|
+
expect(statuses.UPLOADING).toBe('uploading')
|
|
42
|
+
expect(statuses.UPLOADED).toBe('uploaded')
|
|
43
|
+
expect(statuses.UPLOAD_KO).toBe('upload_ko')
|
|
44
|
+
expect(statuses.VALIDATED).toBe('validated')
|
|
45
|
+
expect(statuses.ZIPPING).toBe('zipping')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('should support grouped DOWNLOAD and UPLOAD status namespaces with backward-compatible values', () => {
|
|
49
|
+
expect(statuses.DOWNLOAD.STARTED).toBe('downloading')
|
|
50
|
+
expect(statuses.DOWNLOAD.FINISHED).toBe('downloaded')
|
|
51
|
+
expect(statuses.DOWNLOAD.OK).toBe('downloaded')
|
|
52
|
+
expect(statuses.DOWNLOAD.KO).toBe('download_ko')
|
|
53
|
+
|
|
54
|
+
expect(statuses.UPLOAD.STARTED).toBe('uploading')
|
|
55
|
+
expect(statuses.UPLOAD.FINISHED).toBe('uploaded')
|
|
56
|
+
expect(statuses.UPLOAD.OK).toBe('uploaded')
|
|
57
|
+
expect(statuses.UPLOAD.KO).toBe('upload_ko')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('should support grouped DOCUMENT status namespace with expected lifecycle values', () => {
|
|
61
|
+
expect(statuses.DOCUMENT.DRAFT).toBe('draft')
|
|
62
|
+
expect(statuses.DOCUMENT.PENDING).toBe('pending')
|
|
63
|
+
expect(statuses.DOCUMENT.APPROVED).toBe('approved')
|
|
64
|
+
expect(statuses.DOCUMENT.REJECTED).toBe('rejected')
|
|
65
|
+
expect(statuses.DOCUMENT.PUBLISHED).toBe('published')
|
|
66
|
+
expect(statuses.DOCUMENT.ARCHIVED).toBe('archived')
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
|
package/src/common/statuses.ts
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
1
|
+
import { statuses } from '@quatrain/types'
|
|
2
|
+
|
|
3
|
+
export const ACTIVE = statuses.ACTIVE
|
|
4
|
+
export const APPROVED = statuses.APPROVED
|
|
5
|
+
export const ARCHIVED = statuses.ARCHIVED
|
|
6
|
+
export const BLOCKED = statuses.BLOCKED
|
|
7
|
+
export const CANCELLED = statuses.CANCELLED
|
|
8
|
+
export const COMPLETED = statuses.COMPLETED
|
|
9
|
+
export const CONVERTING = statuses.CONVERTING
|
|
10
|
+
export const CREATED = statuses.CREATED
|
|
11
|
+
export const DELETABLE = statuses.DELETABLE
|
|
12
|
+
export const DELETED = statuses.DELETED
|
|
13
|
+
export const DISABLED = statuses.DISABLED
|
|
14
|
+
export const DONE = statuses.DONE
|
|
15
|
+
export const DRAFT = statuses.DRAFT
|
|
16
|
+
export const DOWNLOADING = statuses.DOWNLOADING
|
|
17
|
+
export const DOWNLOADED = statuses.DOWNLOADED
|
|
18
|
+
export const DOWNLOAD_KO = statuses.DOWNLOAD_KO
|
|
19
|
+
export const ERROR = statuses.ERROR
|
|
20
|
+
export const EXPIRED = statuses.EXPIRED
|
|
21
|
+
export const FAILED = statuses.FAILED
|
|
22
|
+
export const GENERATING = statuses.GENERATING
|
|
23
|
+
export const GENERATED = statuses.GENERATED
|
|
24
|
+
export const IN_PROGRESS = statuses.IN_PROGRESS
|
|
25
|
+
export const KO = statuses.KO
|
|
26
|
+
export const OK = statuses.OK
|
|
27
|
+
export const PAUSED = statuses.PAUSED
|
|
28
|
+
export const PENDING = statuses.PENDING
|
|
29
|
+
export const PREPARING = statuses.PREPARING
|
|
30
|
+
export const PROCESSING = statuses.PROCESSING
|
|
31
|
+
export const PUBLISHED = statuses.PUBLISHED
|
|
32
|
+
export const QUEUED = statuses.QUEUED
|
|
33
|
+
export const REJECTED = statuses.REJECTED
|
|
34
|
+
export const RUNNING = statuses.RUNNING
|
|
35
|
+
export const SUCCESS = statuses.SUCCESS
|
|
36
|
+
export const SUSPENDED = statuses.SUSPENDED
|
|
37
|
+
export const UNKNOWN = statuses.UNKNOWN
|
|
38
|
+
export const UPDATED = statuses.UPDATED
|
|
39
|
+
export const UPLOADING = statuses.UPLOADING
|
|
40
|
+
export const UPLOADED = statuses.UPLOADED
|
|
41
|
+
export const UPLOAD_KO = statuses.UPLOAD_KO
|
|
42
|
+
export const VALIDATED = statuses.VALIDATED
|
|
43
|
+
export const ZIPPING = statuses.ZIPPING
|
|
44
|
+
|
|
45
|
+
export const DOWNLOAD = statuses.DOWNLOAD
|
|
46
|
+
export const UPLOAD = statuses.UPLOAD
|
|
47
|
+
export const DOCUMENT = statuses.DOCUMENT
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
@@ -1,188 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Unique global reference system for all Quatrain models.
|
|
3
|
-
* Used for backend identification and cross-system relational links.
|
|
4
|
-
*/
|
|
5
|
-
export class ObjectUri {
|
|
6
|
-
/** Root path divider. */
|
|
7
|
-
static DEFAULT = '/'
|
|
8
|
-
/** Placeholder used when collections cannot be guessed. */
|
|
9
|
-
static MISSING_COLLECTION = '_?_'
|
|
10
|
-
|
|
11
|
-
protected _str: string
|
|
12
|
-
protected _pairs: Array<string> = []
|
|
13
|
-
protected _literal: string = ''
|
|
14
|
-
protected _backend: string | undefined
|
|
15
|
-
protected _path: string = ObjectUri.DEFAULT
|
|
16
|
-
protected _uid: string | undefined = undefined
|
|
17
|
-
protected _collection: string | undefined = undefined
|
|
18
|
-
protected _label: string | undefined = ''
|
|
19
|
-
protected _objClass: any
|
|
20
|
-
protected _parent: ObjectUri | undefined
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* create object uri from string:
|
|
24
|
-
* ex: 'xyz', '@backend:xyz', 'collection/xyz', '@backend:collection/xyz'
|
|
25
|
-
* some backends will need a collection or table name, some may deduct it from object
|
|
26
|
-
* @param str partial or full resource path
|
|
27
|
-
* @param label optional label to describe path
|
|
28
|
-
*/
|
|
29
|
-
constructor(str: string = '', label: string | undefined = '') {
|
|
30
|
-
this._str = str
|
|
31
|
-
this._label = label
|
|
32
|
-
if (str.includes(':')) {
|
|
33
|
-
const [backend, path] = str.split(':')
|
|
34
|
-
this._backend = backend
|
|
35
|
-
this._path = path
|
|
36
|
-
} else {
|
|
37
|
-
this._path = str
|
|
38
|
-
}
|
|
39
|
-
const parts = this._path.split(ObjectUri.DEFAULT)
|
|
40
|
-
const isFilePath = parts[parts.length - 1].indexOf('.') !== -1
|
|
41
|
-
|
|
42
|
-
if (isFilePath) {
|
|
43
|
-
this._uid = parts[parts.length - 1]
|
|
44
|
-
} else if (parts.length === 1) {
|
|
45
|
-
// It is allowed to only give the uid part of the uri
|
|
46
|
-
// provided that collection will be injected by another means
|
|
47
|
-
this._uid = parts[0].length > 0 ? parts[0] : undefined
|
|
48
|
-
this._collection = ObjectUri.MISSING_COLLECTION
|
|
49
|
-
this._pairs.push(
|
|
50
|
-
`${ObjectUri.MISSING_COLLECTION}${ObjectUri.DEFAULT}${this._uid}`
|
|
51
|
-
)
|
|
52
|
-
this._label = label || this._uid
|
|
53
|
-
} else if (parts.length % 2 === 0) {
|
|
54
|
-
this._path = parts.slice(parts.length - 2).join(ObjectUri.DEFAULT)
|
|
55
|
-
this._uid = parts[parts.length - 1]
|
|
56
|
-
this._collection = parts[parts.length - 2]
|
|
57
|
-
if (parts.length > 2) {
|
|
58
|
-
this._parent = new ObjectUri(
|
|
59
|
-
parts.slice(0, parts.length - 2).join(ObjectUri.DEFAULT)
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
this._label = label || this._uid
|
|
63
|
-
} else if (!isFilePath) {
|
|
64
|
-
// if the last part is not a filename with extension, throw error
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Path parts number must be 1 or even, received: '${str}'`
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
set class(objClass: any) {
|
|
72
|
-
this._objClass = objClass
|
|
73
|
-
if (objClass) {
|
|
74
|
-
this._collection =
|
|
75
|
-
objClass.COLLECTION ||
|
|
76
|
-
(objClass.name && objClass.name.toLowerCase())
|
|
77
|
-
} else {
|
|
78
|
-
this._collection = undefined
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get class() {
|
|
83
|
-
return this._objClass
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get backend() {
|
|
87
|
-
return this._backend
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Returns the full path of the resource
|
|
92
|
-
* including optional parents' path
|
|
93
|
-
* @returns string
|
|
94
|
-
*/
|
|
95
|
-
get path() {
|
|
96
|
-
return this._parent
|
|
97
|
-
? `${this._parent.path}${ObjectUri.DEFAULT}${this._path}`
|
|
98
|
-
: this._path
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Returns the own path of the resource
|
|
103
|
-
* without the optional parents' paths
|
|
104
|
-
* @returns string
|
|
105
|
-
*/
|
|
106
|
-
get ownPath() {
|
|
107
|
-
return this._path
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
get parent() {
|
|
111
|
-
return this._parent
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
set label(label: string | undefined) {
|
|
115
|
-
this._label = label
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
get label() {
|
|
119
|
-
return this._label
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Return the full path litteral
|
|
124
|
-
* including the backend alias
|
|
125
|
-
* @returns string
|
|
126
|
-
*/
|
|
127
|
-
get literal() {
|
|
128
|
-
return this._str.includes(':')
|
|
129
|
-
? this._str
|
|
130
|
-
: `${this._backend}:${this._str}`
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
set path(path: string) {
|
|
134
|
-
// if (this._path && this._path !== ObjectUri.DEFAULT) {
|
|
135
|
-
// throw new Error(`Path value already set with '${this._path}'`)
|
|
136
|
-
// }
|
|
137
|
-
this._path = path
|
|
138
|
-
// TODO manage paths to subcollection
|
|
139
|
-
this._collection = path.split('/')[0]
|
|
140
|
-
this._literal = `${this._backend}:${this._path}`
|
|
141
|
-
this._uid = path.split('/').pop()
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
get uid() {
|
|
145
|
-
return this._uid
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
get collection(): string | undefined {
|
|
149
|
-
return this._collection === ObjectUri.MISSING_COLLECTION
|
|
150
|
-
? undefined
|
|
151
|
-
: this._collection
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
set collection(collection: string | undefined) {
|
|
155
|
-
if (this.collection !== undefined) {
|
|
156
|
-
throw new Error('Collection value already set')
|
|
157
|
-
}
|
|
158
|
-
this._collection = collection
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Return references to find object locally and remotely
|
|
163
|
-
* @returns object
|
|
164
|
-
*/
|
|
165
|
-
toReference() {
|
|
166
|
-
return {
|
|
167
|
-
ref: this.path,
|
|
168
|
-
uri: this._literal,
|
|
169
|
-
label: this._label,
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Output pure object dictionary representation.
|
|
175
|
-
*
|
|
176
|
-
* @returns Rendered URI block.
|
|
177
|
-
*/
|
|
178
|
-
toJSON() {
|
|
179
|
-
const res: any = {
|
|
180
|
-
ref: this.path,
|
|
181
|
-
label: this._label || '',
|
|
182
|
-
}
|
|
183
|
-
if (this._backend !== undefined) {
|
|
184
|
-
res.backend = this._backend
|
|
185
|
-
}
|
|
186
|
-
return res
|
|
187
|
-
}
|
|
188
|
-
}
|
|
1
|
+
export { ObjectUri } from '@quatrain/types'
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
name: string
|
|
3
|
-
status?: string
|
|
4
|
-
createdBy?: any
|
|
5
|
-
createdAt?: number | string
|
|
6
|
-
updatedBy?: any
|
|
7
|
-
updatedAt?: number | string
|
|
8
|
-
deletedBy?: any
|
|
9
|
-
deletedAt?: number | string
|
|
10
|
-
}
|
|
1
|
+
export type { BaseObjectType } from '@quatrain/types'
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Core } from './Core'
|
|
2
|
-
import * as statuses from './common/statuses'
|
|
3
2
|
import { Property } from './properties/Property'
|
|
4
3
|
import { BaseProperty, BasePropertyType } from './properties/BaseProperty'
|
|
5
4
|
import { StringProperty, StringPropertyType } from './properties/StringProperty'
|
|
@@ -27,28 +26,31 @@ import { ArrayProperty, ArrayPropertyType } from './properties/ArrayProperty'
|
|
|
27
26
|
import { MapProperty, MapPropertyType } from './properties/MapProperty'
|
|
28
27
|
import { FileProperty, FilePropertyType } from './properties/FileProperty'
|
|
29
28
|
import { AbstractObject } from './components/AbstractObject'
|
|
30
|
-
import { ObjectUri } from './components/ObjectUri'
|
|
31
29
|
import { DataObjectClass } from './components/types/DataObjectClass'
|
|
32
30
|
import { DataObject } from './components/DataObject'
|
|
33
31
|
import { DataObjectProperties } from './properties'
|
|
34
32
|
import { BaseObject } from './components/BaseObject'
|
|
35
33
|
import { BaseObjectProperties } from './components/BaseObjectProperties'
|
|
36
|
-
import { BaseObjectType } from './components/types/BaseObjectType'
|
|
37
34
|
import { Proxy } from './components/types/ProxyConstructor'
|
|
38
35
|
|
|
39
36
|
import { UserType, User, UserProperties } from './components/User'
|
|
40
37
|
import { EntityType, Entity } from './components/Entity'
|
|
41
38
|
|
|
39
|
+
import * as htmlType from './properties/types/PropertyHTMLType'
|
|
40
|
+
import { DataObjectParams } from './components/types/DataObjectParams'
|
|
41
|
+
|
|
42
|
+
// Import types, interfaces, and exceptions from the leaf package
|
|
42
43
|
import {
|
|
44
|
+
ObjectUri,
|
|
45
|
+
statuses,
|
|
46
|
+
BaseObjectType,
|
|
43
47
|
BadRequestError,
|
|
44
48
|
UnauthorizedError,
|
|
45
49
|
ForbiddenError,
|
|
46
50
|
NotFoundError,
|
|
47
51
|
GoneError,
|
|
48
52
|
ValidationError,
|
|
49
|
-
} from '
|
|
50
|
-
import * as htmlType from './properties/types/PropertyHTMLType'
|
|
51
|
-
import { DataObjectParams } from './components/types/DataObjectParams'
|
|
53
|
+
} from '@quatrain/types'
|
|
52
54
|
|
|
53
55
|
export {
|
|
54
56
|
htmlType,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DateTimeProperty } from './DateTimeProperty'
|
|
2
|
+
|
|
3
|
+
describe('DateTimeProperty', () => {
|
|
4
|
+
afterEach(() => {
|
|
5
|
+
// Restore default global setting after each test
|
|
6
|
+
DateTimeProperty.RETURN_AS = DateTimeProperty.AS_IS
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
describe('timezone configuration', () => {
|
|
10
|
+
it('should default to "Z" timezone if none is provided', () => {
|
|
11
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
12
|
+
expect(prop.timezone).toBe('Z')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('should accept and return a custom timezone string', () => {
|
|
16
|
+
const prop = new DateTimeProperty({ name: 'testDate', timezone: 'Europe/Paris' })
|
|
17
|
+
expect(prop.timezone).toBe('Europe/Paris')
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
describe('value setting with default RETURN_AS = asis', () => {
|
|
22
|
+
it('should set and get values unmodified', () => {
|
|
23
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
24
|
+
const date = new Date()
|
|
25
|
+
|
|
26
|
+
prop.set(date)
|
|
27
|
+
expect(prop.val()).toBe(date)
|
|
28
|
+
|
|
29
|
+
prop.set('2026-05-24T09:00:00Z')
|
|
30
|
+
expect(prop.val()).toBe('2026-05-24T09:00:00Z')
|
|
31
|
+
|
|
32
|
+
prop.set(1716537600000)
|
|
33
|
+
expect(prop.val()).toBe(1716537600000)
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('value setting with RETURN_AS = unix_timestamp', () => {
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
DateTimeProperty.RETURN_AS = DateTimeProperty.UNIX_TIMESTAMP
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('should convert JS Date objects to UNIX timestamp milliseconds', () => {
|
|
43
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
44
|
+
const date = new Date('2026-05-24T12:00:00.000Z')
|
|
45
|
+
|
|
46
|
+
prop.set(date)
|
|
47
|
+
expect(prop.val()).toBe(date.getTime())
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('should parse ISO strings with trailing Z as UTC timestamps', () => {
|
|
51
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
52
|
+
prop.set('2026-05-24T12:00:00.000Z')
|
|
53
|
+
|
|
54
|
+
const expectedTime = Date.parse('2026-05-24T12:00:00.000Z')
|
|
55
|
+
expect(prop.val()).toBe(expectedTime)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('should parse ISO strings with timezone offsets correctly', () => {
|
|
59
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
60
|
+
prop.set('2026-05-24T12:00:00+02:00')
|
|
61
|
+
|
|
62
|
+
const expectedTime = Date.parse('2026-05-24T12:00:00+02:00')
|
|
63
|
+
expect(prop.val()).toBe(expectedTime)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('should treat plain date strings without timezone as UTC by appending T and Z', () => {
|
|
67
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
68
|
+
|
|
69
|
+
// Non-ISO string with space, no offset
|
|
70
|
+
prop.set('2026-05-24 12:00:00')
|
|
71
|
+
|
|
72
|
+
const expectedTime = Date.parse('2026-05-24T12:00:00Z')
|
|
73
|
+
expect(prop.val()).toBe(expectedTime)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('should pass numeric timestamps directly', () => {
|
|
77
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
78
|
+
const timestamp = 1716552000000
|
|
79
|
+
|
|
80
|
+
prop.set(timestamp)
|
|
81
|
+
expect(prop.val()).toBe(timestamp)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('should handle falsy/empty values gracefully without throw', () => {
|
|
85
|
+
const prop = new DateTimeProperty({ name: 'testDate' })
|
|
86
|
+
|
|
87
|
+
prop.set('')
|
|
88
|
+
expect(prop.val()).toBe('')
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
})
|