@platecms/delta-types 0.1.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/README.md +19 -0
- package/package.json +27 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +10 -0
- package/src/index.js.map +1 -0
- package/src/lib/constructor.type.d.ts +1 -0
- package/src/lib/constructor.type.js +3 -0
- package/src/lib/constructor.type.js.map +1 -0
- package/src/lib/content-value-type.type.d.ts +16 -0
- package/src/lib/content-value-type.type.js +16 -0
- package/src/lib/content-value-type.type.js.map +1 -0
- package/src/lib/header-keys.enum.d.ts +5 -0
- package/src/lib/header-keys.enum.js +10 -0
- package/src/lib/header-keys.enum.js.map +1 -0
- package/src/lib/primitive.type.d.ts +4 -0
- package/src/lib/primitive.type.js +7 -0
- package/src/lib/primitive.type.js.map +1 -0
- package/src/lib/return-constructor-function.type.d.ts +2 -0
- package/src/lib/return-constructor-function.type.js +3 -0
- package/src/lib/return-constructor-function.type.js.map +1 -0
- package/src/lib/stage.enum.d.ts +4 -0
- package/src/lib/stage.enum.js +9 -0
- package/src/lib/stage.enum.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# types
|
|
2
|
+
|
|
3
|
+
This package contains a number of general utility types that are used throughout many projects.
|
|
4
|
+
|
|
5
|
+
- [Features](#features)
|
|
6
|
+
|
|
7
|
+
# Features
|
|
8
|
+
|
|
9
|
+
- `Constructor<T>` which is a type that represents the constructor of a class.
|
|
10
|
+
- `ContentValueTypeName<T>` type which maps the type `T` to the corresponding `ContentValueTypeName`.
|
|
11
|
+
- `ContentValueTypeNames` which represents the names of the different types which a Content Value can be.
|
|
12
|
+
- `ContentValueType` which represents the different types which a Content Value can be.
|
|
13
|
+
- `HeaderKeys` enum which represents the keys of custom request headers.
|
|
14
|
+
- `PrimitiveConstructor` union which represents the constructors of the primitive types.
|
|
15
|
+
- `Primitive` union which represents the primitive types.
|
|
16
|
+
- `ReturnConstructorFunction` function which returns the constructor of a function. This is useful for certain metadata
|
|
17
|
+
applications.
|
|
18
|
+
- `Stage` enum which represents the different stages in which Content can be.
|
|
19
|
+
- `isPrimitiveType` function which checks if a given constructor is a primitive constructor.
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@platecms/delta-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "This package contains various utility types.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://bitbucket.org/startmetplate/delta.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://bitbucket.org/startmetplate/delta/src/dev/packages/types",
|
|
14
|
+
"main": "./src/index.js",
|
|
15
|
+
"types": "./src/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"src/**/*"
|
|
18
|
+
],
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@platecms/delta-cast": "*",
|
|
21
|
+
"@platecms/delta-plate-resource-notation": "*",
|
|
22
|
+
"class-transformer": "0.5.1",
|
|
23
|
+
"reflect-metadata": "0.2.2",
|
|
24
|
+
"tslib": "2.8.1"
|
|
25
|
+
},
|
|
26
|
+
"type": "commonjs"
|
|
27
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/return-constructor-function.type"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/constructor.type"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/content-value-type.type"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/primitive.type"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/stage.enum"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/header-keys.enum"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/types/src/index.ts"],"names":[],"mappings":";;;AAAA,iFAAuD;AACvD,iEAAuC;AACvC,wEAA8C;AAC9C,+DAAqC;AACrC,2DAAiC;AACjC,iEAAuC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Constructor<T = unknown> = new (...args: any[]) => T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constructor.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/constructor.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
15
|
+
export type ContentValueType = Primitive | PRN | Root;
|
|
16
|
+
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.GRID_PLACEMENT | ContentValueTypeNames.PATH_PART : never;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 || (exports.ContentValueTypeNames = ContentValueTypeNames = {}));
|
|
16
|
+
//# sourceMappingURL=content-value-type.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-value-type.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/content-value-type.type.ts"],"names":[],"mappings":";;;AAIA,IAAY,qBAUX;AAVD,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;AAC3B,CAAC,EAVW,qBAAqB,qCAArB,qBAAqB,QAUhC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
4
|
+
export declare function isPrimitiveType(type: Constructor): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/primitive.type.ts"],"names":[],"mappings":";;AAgBA,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"return-constructor-function.type.js","sourceRoot":"","sources":["../../../../../../packages/types/src/lib/return-constructor-function.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|