@platecms/delta-types 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platecms/delta-types",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "This package contains various utility types.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -17,11 +17,10 @@
17
17
  "src/**/*"
18
18
  ],
19
19
  "peerDependencies": {
20
- "@platecms/delta-cast": "0.6.0",
21
- "@platecms/delta-plate-resource-notation": "0.6.0",
20
+ "@platecms/delta-cast": "0.8.0",
21
+ "@platecms/delta-plate-resource-notation": "0.8.0",
22
22
  "class-transformer": "0.5.1",
23
23
  "reflect-metadata": "0.2.2",
24
24
  "tslib": "2.8.1"
25
- },
26
- "type": "commonjs"
25
+ }
27
26
  }
@@ -0,0 +1,6 @@
1
+ export const enum ActionType {
2
+ CREATE = "create",
3
+ READ = "read",
4
+ UPDATE = "update",
5
+ REMOVE = "remove",
6
+ }
@@ -1 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
2
  export type Constructor<T = unknown> = new (...args: any[]) => T;
@@ -0,0 +1,39 @@
1
+ import { PRN } from "@platecms/delta-plate-resource-notation";
2
+ import { Primitive } from "./primitive.type";
3
+ import { Root } from "@platecms/delta-cast";
4
+
5
+ export enum ContentValueTypeNames {
6
+ STRING = "STRING",
7
+ NUMBER = "NUMBER",
8
+ BOOLEAN = "BOOLEAN",
9
+ DATE = "DATE",
10
+ CONTENT_ITEM = "CONTENT_ITEM",
11
+ ASSET = "ASSET",
12
+ PATH_PART = "PATH_PART",
13
+ GRID_PLACEMENT = "GRID_PLACEMENT",
14
+ SMART_TEXT = "SMART_TEXT",
15
+ TAG = "TAG",
16
+ CONTENT_TYPE = "CONTENT_TYPE",
17
+ }
18
+
19
+ export type ContentValueType = Primitive | PRN | Root;
20
+
21
+ export type ContentValueTypeName<T> = T extends string
22
+ ? ContentValueTypeNames.STRING
23
+ : T extends number
24
+ ? ContentValueTypeNames.NUMBER
25
+ : T extends boolean
26
+ ? ContentValueTypeNames.BOOLEAN
27
+ : T extends Date
28
+ ? ContentValueTypeNames.DATE
29
+ : T extends Root
30
+ ? ContentValueTypeNames.SMART_TEXT
31
+ : T extends PRN
32
+ ?
33
+ | ContentValueTypeNames.ASSET
34
+ | ContentValueTypeNames.CONTENT_ITEM
35
+ | ContentValueTypeNames.CONTENT_TYPE
36
+ | ContentValueTypeNames.GRID_PLACEMENT
37
+ | ContentValueTypeNames.PATH_PART
38
+ | ContentValueTypeNames.TAG
39
+ : never;
@@ -0,0 +1,5 @@
1
+ export enum HeaderKeys {
2
+ X_DELTA_ORGANIZATION = "x-delta-organization",
3
+ X_DELTA_TRACE_ID = "x-delta-trace-id",
4
+ X_DELTA_STAGE = "x-delta-stage",
5
+ }
@@ -0,0 +1,12 @@
1
+ import { isPrimitiveType } from "./primitive.type";
2
+
3
+ describe("Primitive", () => {
4
+ it.each([
5
+ { primitiveConstructor: String },
6
+ { primitiveConstructor: Number },
7
+ { primitiveConstructor: Boolean },
8
+ { primitiveConstructor: Date },
9
+ ])("returns true for the PrimitiveConstructor '$primitiveConstructor.name'", async ({ primitiveConstructor }) => {
10
+ expect(isPrimitiveType(primitiveConstructor)).toStrictEqual(true);
11
+ });
12
+ });
@@ -0,0 +1,20 @@
1
+ import { Constructor } from "./constructor.type";
2
+
3
+ export type Primitive = Date | boolean | number | string;
4
+
5
+ export type PrimitiveConstructor =
6
+ | Boolean
7
+ | BooleanConstructor
8
+ | Date
9
+ | DateConstructor
10
+ | Number
11
+ | NumberConstructor
12
+ | String
13
+ | StringConstructor
14
+ | boolean
15
+ | number
16
+ | string;
17
+
18
+ export function isPrimitiveType(type: Constructor): boolean {
19
+ return type === String || type === Number || type === Boolean || type === Date;
20
+ }
@@ -1,2 +1,3 @@
1
1
  import { Constructor } from "./constructor.type";
2
+
2
3
  export type ReturnConstructorFunction<TType = unknown> = () => Constructor<TType>;
@@ -0,0 +1,4 @@
1
+ export enum Stage {
2
+ DEVELOPMENT = "DEVELOPMENT",
3
+ PRODUCTION = "PRODUCTION",
4
+ }
package/src/index.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib/content-value-type.type"), exports);
5
- tslib_1.__exportStar(require("./lib/primitive.type"), exports);
6
- tslib_1.__exportStar(require("./lib/stage.enum"), exports);
7
- tslib_1.__exportStar(require("./lib/header-keys.enum"), exports);
8
- tslib_1.__exportStar(require("./lib/action-type.enum"), exports);
9
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/types/src/index.ts"],"names":[],"mappings":";;;AAEA,wEAA8C;AAC9C,+DAAqC;AACrC,2DAAiC;AACjC,iEAAuC;AACvC,iEAAuC"}
@@ -1,6 +0,0 @@
1
- export declare const enum ActionType {
2
- CREATE = "create",
3
- READ = "read",
4
- UPDATE = "update",
5
- REMOVE = "remove"
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=action-type.enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-type.enum.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/action-type.enum.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=constructor.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constructor.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/constructor.type.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- import { PRN } from "@platecms/delta-plate-resource-notation";
2
- import { Primitive } from "./primitive.type";
3
- import { Root } from "@platecms/delta-cast";
4
- export declare enum ContentValueTypeNames {
5
- STRING = "STRING",
6
- NUMBER = "NUMBER",
7
- BOOLEAN = "BOOLEAN",
8
- DATE = "DATE",
9
- CONTENT_ITEM = "CONTENT_ITEM",
10
- ASSET = "ASSET",
11
- PATH_PART = "PATH_PART",
12
- GRID_PLACEMENT = "GRID_PLACEMENT",
13
- SMART_TEXT = "SMART_TEXT",
14
- TAG = "TAG",
15
- CONTENT_TYPE = "CONTENT_TYPE"
16
- }
17
- export type ContentValueType = Primitive | PRN | Root;
18
- export type ContentValueTypeName<T> = T extends string ? ContentValueTypeNames.STRING : T extends number ? ContentValueTypeNames.NUMBER : T extends boolean ? ContentValueTypeNames.BOOLEAN : T extends Date ? ContentValueTypeNames.DATE : T extends Root ? ContentValueTypeNames.SMART_TEXT : T extends PRN ? ContentValueTypeNames.ASSET | ContentValueTypeNames.CONTENT_ITEM | ContentValueTypeNames.CONTENT_TYPE | ContentValueTypeNames.GRID_PLACEMENT | ContentValueTypeNames.PATH_PART | ContentValueTypeNames.TAG : never;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContentValueTypeNames = void 0;
4
- var ContentValueTypeNames;
5
- (function (ContentValueTypeNames) {
6
- ContentValueTypeNames["STRING"] = "STRING";
7
- ContentValueTypeNames["NUMBER"] = "NUMBER";
8
- ContentValueTypeNames["BOOLEAN"] = "BOOLEAN";
9
- ContentValueTypeNames["DATE"] = "DATE";
10
- ContentValueTypeNames["CONTENT_ITEM"] = "CONTENT_ITEM";
11
- ContentValueTypeNames["ASSET"] = "ASSET";
12
- ContentValueTypeNames["PATH_PART"] = "PATH_PART";
13
- ContentValueTypeNames["GRID_PLACEMENT"] = "GRID_PLACEMENT";
14
- ContentValueTypeNames["SMART_TEXT"] = "SMART_TEXT";
15
- ContentValueTypeNames["TAG"] = "TAG";
16
- ContentValueTypeNames["CONTENT_TYPE"] = "CONTENT_TYPE";
17
- })(ContentValueTypeNames || (exports.ContentValueTypeNames = ContentValueTypeNames = {}));
18
- //# sourceMappingURL=content-value-type.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-value-type.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/content-value-type.type.ts"],"names":[],"mappings":";;;AAIA,IAAY,qBAYX;AAZD,WAAY,qBAAqB;IAC/B,0CAAiB,CAAA;IACjB,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;IACnB,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B,wCAAe,CAAA;IACf,gDAAuB,CAAA;IACvB,0DAAiC,CAAA;IACjC,kDAAyB,CAAA;IACzB,oCAAW,CAAA;IACX,sDAA6B,CAAA;AAC/B,CAAC,EAZW,qBAAqB,qCAArB,qBAAqB,QAYhC"}
@@ -1,5 +0,0 @@
1
- export declare enum HeaderKeys {
2
- X_DELTA_ORGANIZATION = "x-delta-organization",
3
- X_DELTA_TRACE_ID = "x-delta-trace-id",
4
- X_DELTA_STAGE = "x-delta-stage"
5
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HeaderKeys = void 0;
4
- var HeaderKeys;
5
- (function (HeaderKeys) {
6
- HeaderKeys["X_DELTA_ORGANIZATION"] = "x-delta-organization";
7
- HeaderKeys["X_DELTA_TRACE_ID"] = "x-delta-trace-id";
8
- HeaderKeys["X_DELTA_STAGE"] = "x-delta-stage";
9
- })(HeaderKeys || (exports.HeaderKeys = HeaderKeys = {}));
10
- //# sourceMappingURL=header-keys.enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header-keys.enum.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/header-keys.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2DAA6C,CAAA;IAC7C,mDAAqC,CAAA;IACrC,6CAA+B,CAAA;AACjC,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
@@ -1,4 +0,0 @@
1
- import { Constructor } from "./constructor.type";
2
- export type Primitive = Date | boolean | number | string;
3
- export type PrimitiveConstructor = Boolean | BooleanConstructor | Date | DateConstructor | Number | NumberConstructor | String | StringConstructor | boolean | number | string;
4
- export declare function isPrimitiveType(type: Constructor): boolean;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPrimitiveType = isPrimitiveType;
4
- function isPrimitiveType(type) {
5
- return type === String || type === Number || type === Boolean || type === Date;
6
- }
7
- //# sourceMappingURL=primitive.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"primitive.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/primitive.type.ts"],"names":[],"mappings":";;AAiBA,0CAEC;AAFD,SAAgB,eAAe,CAAC,IAAiB;IAC/C,OAAO,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,IAAI,CAAC;AACjF,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=return-constructor-function.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"return-constructor-function.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/return-constructor-function.type.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export declare enum Stage {
2
- DEVELOPMENT = "DEVELOPMENT",
3
- PRODUCTION = "PRODUCTION"
4
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Stage = void 0;
4
- var Stage;
5
- (function (Stage) {
6
- Stage["DEVELOPMENT"] = "DEVELOPMENT";
7
- Stage["PRODUCTION"] = "PRODUCTION";
8
- })(Stage || (exports.Stage = Stage = {}));
9
- //# sourceMappingURL=stage.enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stage.enum.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/stage.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,oCAA2B,CAAA;IAC3B,kCAAyB,CAAA;AAC3B,CAAC,EAHW,KAAK,qBAAL,KAAK,QAGhB"}
File without changes