@nyrra/maker 0.0.1
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 +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/ontology-maker.d.ts +119 -0
- package/dist/lib/ontology-maker.js +60 -0
- package/package.json +48 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib/ontology-maker.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib/ontology-maker.js";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export declare const UPSTREAM_MAKER_PACKAGE = "@osdk/maker";
|
|
2
|
+
export declare const UPSTREAM_MAKER_VERSION = "0.16.0-beta.7";
|
|
3
|
+
export type TableName = `datastudio_${string}`;
|
|
4
|
+
export type TableCategory = "master-data" | "quality-events" | "analytics" | "system";
|
|
5
|
+
export type TableDomain = "masterData" | "pharmaQualityOps" | "analytics" | "application" | "accessControl";
|
|
6
|
+
export type ExampleValue = boolean | null | number | string | readonly ExampleValue[];
|
|
7
|
+
export type PrimitiveTypeName = "boolean" | "double" | "integer" | "string" | "timestamp";
|
|
8
|
+
export interface PrimitiveValueTypeDefinition {
|
|
9
|
+
readonly type: PrimitiveTypeName;
|
|
10
|
+
}
|
|
11
|
+
export interface EnumValueTypeDefinition {
|
|
12
|
+
readonly type: "enum";
|
|
13
|
+
readonly values: readonly [string, ...string[]];
|
|
14
|
+
}
|
|
15
|
+
export type ValueTypeDefinitionInput = EnumValueTypeDefinition | PrimitiveValueTypeDefinition;
|
|
16
|
+
export interface PrismantixValueTypeDefinition {
|
|
17
|
+
readonly apiName: string;
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
readonly displayName: string;
|
|
20
|
+
readonly entityType: "valueType";
|
|
21
|
+
readonly exampleValues?: readonly ExampleValue[];
|
|
22
|
+
readonly type: ValueTypeDefinitionInput;
|
|
23
|
+
}
|
|
24
|
+
export interface ExternalObjectDefinition {
|
|
25
|
+
readonly apiName: string;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly displayName: string;
|
|
28
|
+
readonly entityType: "externalObject";
|
|
29
|
+
readonly pluralDisplayName: string;
|
|
30
|
+
readonly tableName: TableName;
|
|
31
|
+
}
|
|
32
|
+
export type ReferenceTarget = ExternalObjectDefinition | PrismantixObjectDefinition | string;
|
|
33
|
+
export interface PrismantixObjectPropertyDefinition {
|
|
34
|
+
readonly array?: boolean;
|
|
35
|
+
readonly description?: string;
|
|
36
|
+
readonly displayName: string;
|
|
37
|
+
readonly exampleValues?: readonly ExampleValue[];
|
|
38
|
+
readonly nullable?: boolean;
|
|
39
|
+
readonly optional?: boolean;
|
|
40
|
+
readonly reference?: ReferenceTarget;
|
|
41
|
+
readonly type: PrimitiveTypeName | PrismantixValueTypeDefinition;
|
|
42
|
+
}
|
|
43
|
+
export interface OntologyIndexDefinition {
|
|
44
|
+
readonly fields: readonly [string, ...string[]];
|
|
45
|
+
readonly name: string;
|
|
46
|
+
}
|
|
47
|
+
export interface PrismantixObjectMetadata {
|
|
48
|
+
readonly category: TableCategory;
|
|
49
|
+
readonly convex: {
|
|
50
|
+
readonly componentName: "ontology";
|
|
51
|
+
readonly indexes: readonly OntologyIndexDefinition[];
|
|
52
|
+
readonly materialized: boolean;
|
|
53
|
+
readonly tableName: TableName;
|
|
54
|
+
};
|
|
55
|
+
readonly defaults?: {
|
|
56
|
+
readonly fabricationCount?: number;
|
|
57
|
+
readonly seedCount?: number;
|
|
58
|
+
};
|
|
59
|
+
readonly domain: TableDomain;
|
|
60
|
+
readonly guidance?: readonly string[];
|
|
61
|
+
readonly notes?: string;
|
|
62
|
+
readonly requiresClient: boolean;
|
|
63
|
+
readonly seeding?: {
|
|
64
|
+
readonly order?: number;
|
|
65
|
+
readonly requires?: readonly TableName[];
|
|
66
|
+
readonly skipReason?: string;
|
|
67
|
+
};
|
|
68
|
+
readonly showInNavigation: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface PrismantixObjectDefinition {
|
|
71
|
+
readonly aliases?: readonly string[];
|
|
72
|
+
readonly apiName: string;
|
|
73
|
+
readonly description?: string;
|
|
74
|
+
readonly displayName: string;
|
|
75
|
+
readonly editsEnabled?: boolean;
|
|
76
|
+
readonly entityType: "object";
|
|
77
|
+
readonly pluralDisplayName: string;
|
|
78
|
+
readonly primaryKeyPropertyApiName: string;
|
|
79
|
+
readonly prismantix: PrismantixObjectMetadata;
|
|
80
|
+
readonly properties: Readonly<Record<string, PrismantixObjectPropertyDefinition>>;
|
|
81
|
+
readonly titlePropertyApiName: string;
|
|
82
|
+
}
|
|
83
|
+
export interface LinkSideDefinition {
|
|
84
|
+
readonly apiName: string;
|
|
85
|
+
readonly description?: string;
|
|
86
|
+
readonly displayName: string;
|
|
87
|
+
readonly object: ReferenceTarget;
|
|
88
|
+
readonly pluralDisplayName: string;
|
|
89
|
+
}
|
|
90
|
+
export interface OneToManyLinkDefinition {
|
|
91
|
+
readonly apiName: string;
|
|
92
|
+
readonly cardinality?: "OneToMany" | "OneToOne";
|
|
93
|
+
readonly description?: string;
|
|
94
|
+
readonly entityType: "link";
|
|
95
|
+
readonly manyForeignKeyProperty: string;
|
|
96
|
+
readonly one: LinkSideDefinition;
|
|
97
|
+
readonly toMany: LinkSideDefinition;
|
|
98
|
+
}
|
|
99
|
+
export interface ManyToManyLinkDefinition {
|
|
100
|
+
readonly apiName: string;
|
|
101
|
+
readonly description?: string;
|
|
102
|
+
readonly entityType: "link";
|
|
103
|
+
readonly many: LinkSideDefinition;
|
|
104
|
+
readonly manyForeignKeyProperty?: string;
|
|
105
|
+
readonly toMany: LinkSideDefinition;
|
|
106
|
+
readonly toManyForeignKeyProperty?: string;
|
|
107
|
+
}
|
|
108
|
+
export type PrismantixLinkDefinition = ManyToManyLinkDefinition | OneToManyLinkDefinition;
|
|
109
|
+
export declare function defineValueType(valueType: Omit<PrismantixValueTypeDefinition, "entityType">): PrismantixValueTypeDefinition;
|
|
110
|
+
export declare function defineExternalObject(object: Omit<ExternalObjectDefinition, "entityType">): ExternalObjectDefinition;
|
|
111
|
+
export declare function defineObject(object: Omit<PrismantixObjectDefinition, "entityType">): PrismantixObjectDefinition;
|
|
112
|
+
export declare function defineLink(link: Omit<OneToManyLinkDefinition, "entityType">): OneToManyLinkDefinition;
|
|
113
|
+
export declare function defineLink(link: Omit<ManyToManyLinkDefinition, "entityType">): ManyToManyLinkDefinition;
|
|
114
|
+
export declare function uppercaseFirstLetter(value: string | null | undefined): string;
|
|
115
|
+
export declare function convertToDisplayName(value: string | null | undefined): string;
|
|
116
|
+
export declare function convertToPluralDisplayName(value: string | null | undefined): string;
|
|
117
|
+
export declare function isEnumValueType(valueType: PrismantixValueTypeDefinition): valueType is PrismantixValueTypeDefinition & {
|
|
118
|
+
readonly type: EnumValueTypeDefinition;
|
|
119
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const UPSTREAM_MAKER_PACKAGE = "@osdk/maker";
|
|
2
|
+
export const UPSTREAM_MAKER_VERSION = "0.16.0-beta.7";
|
|
3
|
+
export function defineValueType(valueType) {
|
|
4
|
+
return {
|
|
5
|
+
...valueType,
|
|
6
|
+
entityType: "valueType",
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function defineExternalObject(object) {
|
|
10
|
+
return {
|
|
11
|
+
...object,
|
|
12
|
+
entityType: "externalObject",
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function defineObject(object) {
|
|
16
|
+
return {
|
|
17
|
+
...object,
|
|
18
|
+
entityType: "object",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function defineLink(link) {
|
|
22
|
+
return {
|
|
23
|
+
...link,
|
|
24
|
+
entityType: "link",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function uppercaseFirstLetter(value) {
|
|
28
|
+
if (!value) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
32
|
+
}
|
|
33
|
+
export function convertToDisplayName(value) {
|
|
34
|
+
if (!value) {
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
return value
|
|
38
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
39
|
+
.replace(/[_-]+/g, " ")
|
|
40
|
+
.split(" ")
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.map((part) => uppercaseFirstLetter(part))
|
|
43
|
+
.join(" ");
|
|
44
|
+
}
|
|
45
|
+
export function convertToPluralDisplayName(value) {
|
|
46
|
+
const displayName = convertToDisplayName(value);
|
|
47
|
+
if (!displayName) {
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
if (displayName.endsWith("s")) {
|
|
51
|
+
return displayName;
|
|
52
|
+
}
|
|
53
|
+
if (displayName.endsWith("y")) {
|
|
54
|
+
return `${displayName.slice(0, -1)}ies`;
|
|
55
|
+
}
|
|
56
|
+
return `${displayName}s`;
|
|
57
|
+
}
|
|
58
|
+
export function isEnumValueType(valueType) {
|
|
59
|
+
return valueType.type.type === "enum";
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nyrra/maker",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Nyrra-maintained Maker fork for ontology-as-code definitions.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/nyrra-labs/prismantix.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/nyrra-labs/prismantix#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/nyrra-labs/prismantix/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"maker",
|
|
17
|
+
"ontology",
|
|
18
|
+
"ontology-as-code",
|
|
19
|
+
"palantir",
|
|
20
|
+
"osdk"
|
|
21
|
+
],
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"@prismantix/source": "./src/index.ts",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"!dist/**/*.map",
|
|
37
|
+
"!**/*.tsbuildinfo"
|
|
38
|
+
],
|
|
39
|
+
"nx": {
|
|
40
|
+
"name": "maker"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"tslib": "^2.3.0"
|
|
47
|
+
}
|
|
48
|
+
}
|