@osdk/maker-import 0.1.0 → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @osdk/maker-import
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9ce366a: Maker import codegen
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [a6f4208]
12
+ - @osdk/maker@0.19.0
@@ -21,7 +21,7 @@ import yargs from "yargs";
21
21
  import { hideBin } from "yargs/helpers";
22
22
  import { writeImportedOntology } from "../generate/writeImportedOntology.js";
23
23
  export default async function main(args = process.argv) {
24
- const commandLineOpts = await yargs(hideBin(args)).version("0.1.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
24
+ const commandLineOpts = await yargs(hideBin(args)).version("0.2.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
25
25
  input: {
26
26
  alias: "i",
27
27
  describe: "Path to OntologyFullMetadata JSON file",
@@ -571,7 +571,7 @@ export const ${varName}: ${typeName} = wrapWithProxy(${varName}_base);
571
571
 
572
572
  // src/cli/main.ts
573
573
  async function main(args = process.argv) {
574
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.1.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
574
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.2.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
575
575
  input: {
576
576
  alias: "i",
577
577
  describe: "Path to OntologyFullMetadata JSON file",
@@ -21,7 +21,7 @@ import yargs from "yargs";
21
21
  import { hideBin } from "yargs/helpers";
22
22
  import { writeImportedOntology } from "../generate/writeImportedOntology.js";
23
23
  export default async function main(args = process.argv) {
24
- const commandLineOpts = await yargs(hideBin(args)).version("0.1.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
24
+ const commandLineOpts = await yargs(hideBin(args)).version("0.2.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
25
25
  input: {
26
26
  alias: "i",
27
27
  describe: "Path to OntologyFullMetadata JSON file",
@@ -0,0 +1 @@
1
+ export default function main(args?: string[]): Promise<void>;
@@ -0,0 +1 @@
1
+ {"mappings":"eAuBe,SAAe,KAC5BA,kBACC","names":["args: string[]"],"sources":["../../../src/cli/main.ts"],"version":3,"file":"main.d.ts"}
@@ -0,0 +1,41 @@
1
+ import { OntologyEntityTypeEnum } from "@osdk/maker";
2
+ interface GatewayActionTypeV2 {
3
+ apiName: string;
4
+ displayName?: string;
5
+ description?: string;
6
+ status: string;
7
+ parameters: Record<string, {
8
+ displayName?: string
9
+ description?: string
10
+ dataType: {
11
+ type: string
12
+ [key: string]: unknown
13
+ }
14
+ required: boolean
15
+ }>;
16
+ operations: Array<{
17
+ type: string
18
+ [key: string]: unknown
19
+ }>;
20
+ }
21
+ interface ConvertedActionParameter {
22
+ id: string;
23
+ displayName: string;
24
+ type: string | {
25
+ type: string
26
+ [key: string]: unknown
27
+ };
28
+ validation: {
29
+ required?: boolean
30
+ };
31
+ }
32
+ interface ConvertedActionType {
33
+ __type: OntologyEntityTypeEnum.ACTION_TYPE;
34
+ apiName: string;
35
+ displayName: string;
36
+ status: string;
37
+ rules: Array<unknown>;
38
+ parameters: Array<ConvertedActionParameter>;
39
+ }
40
+ export declare function convertActionType(action: GatewayActionTypeV2): ConvertedActionType;
41
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,SAAS,8BAA8B,aAAc;UAK3C,oBAAoB;CAC5B;CACA;CACA;CACA;CACA,YAAY,eAEV;EACE;EACA;EACA,UAAU;GAAE;;EAAsC;EAClD;CACD;CAEH,YAAY,MAAM;EAAE;;CAAsC;AAC3D;UAGS,yBAAyB;CACjC;CACA;CACA,eAAe;EAAE;;CAAsC;CACvD,YAAY;EAAE;CAAoB;AACnC;UAGS,oBAAoB;CAC5B,QAAQ,uBAAuB;CAC/B;CACA;CACA;CACA,OAAO;CACP,YAAY,MAAM;AACnB;AAED,OAAO,iBAAS,kBACdA,QAAQ,sBACP","names":["action: GatewayActionTypeV2"],"sources":["../../../src/generate/convertActionType.ts"],"version":3,"file":"convertActionType.d.ts"}
@@ -0,0 +1,34 @@
1
+ import type { InterfaceType } from "@osdk/maker";
2
+ interface GatewayInterfaceType {
3
+ apiName: string;
4
+ displayName?: string;
5
+ description?: string;
6
+ extendsInterfaces: ReadonlyArray<string>;
7
+ properties: Record<string, {
8
+ apiName: string
9
+ displayName?: string
10
+ description?: string
11
+ dataType: {
12
+ type: string
13
+ [key: string]: unknown
14
+ }
15
+ }>;
16
+ links: Record<string, {
17
+ apiName: string
18
+ displayName?: string
19
+ description?: string
20
+ cardinality: string
21
+ required: boolean
22
+ linkedEntityApiName: {
23
+ type: string
24
+ apiName?: string
25
+ }
26
+ }>;
27
+ }
28
+ /**
29
+ * Converts a gateway InterfaceType to a maker InterfaceType.
30
+ *
31
+ * `allInterfaces` is the full map so we can resolve extendsInterfaces references.
32
+ */
33
+ export declare function convertInterfaceType(iface: GatewayInterfaceType, allInterfaces: Record<string, GatewayInterfaceType>): InterfaceType;
34
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,qBAAyC,aAAc;UAK3D,qBAAqB;CAC7B;CACA;CACA;CACA,mBAAmB;CACnB,YAAY,eAEV;EACE;EACA;EACA;EACA,UAAU;GAAE;;EAAsC;CACnD;CAEH,OAAO,eAEL;EACE;EACA;EACA;EACA;EACA;EACA,qBAAqB;GAAE;GAAc;EAAkB;CACxD;AAEJ;;;;;;AAOD,OAAO,iBAAS,qBACdA,OAAO,sBACPC,eAAe,eAAe,wBAC7B","names":["iface: GatewayInterfaceType","allInterfaces: Record<string, GatewayInterfaceType>"],"sources":["../../../src/generate/convertInterfaceType.ts"],"version":3,"file":"convertInterfaceType.d.ts"}
@@ -0,0 +1,23 @@
1
+ import type { ObjectType } from "@osdk/maker";
2
+ interface GatewayObjectTypeFullMetadata {
3
+ objectType: {
4
+ apiName: string
5
+ displayName?: string
6
+ description?: string
7
+ primaryKey: string
8
+ titleProperty: string
9
+ status: string
10
+ visibility?: string
11
+ properties: Record<string, {
12
+ displayName?: string
13
+ description?: string
14
+ dataType: {
15
+ type: string
16
+ [key: string]: unknown
17
+ }
18
+ }>
19
+ };
20
+ sharedPropertyTypeMapping?: Record<string, string>;
21
+ }
22
+ export declare function convertObjectType(fullMetadata: GatewayObjectTypeFullMetadata): ObjectType;
23
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAkC,kBAAkB,aAAc;UAMxD,8BAA8B;CACtC,YAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,eAEV;GACE;GACA;GACA,UAAU;IAAE;;GAAsC;EACnD;CAEJ;CACD,4BAA4B;AAC7B;AAED,OAAO,iBAAS,kBACdA,cAAc,gCACb","names":["fullMetadata: GatewayObjectTypeFullMetadata"],"sources":["../../../src/generate/convertObjectType.ts"],"version":3,"file":"convertObjectType.d.ts"}
@@ -0,0 +1,12 @@
1
+ import type { SharedPropertyType } from "@osdk/maker";
2
+ interface GatewaySharedPropertyType {
3
+ apiName: string;
4
+ displayName?: string;
5
+ description?: string;
6
+ dataType: {
7
+ type: string
8
+ [key: string]: unknown
9
+ };
10
+ }
11
+ export declare function convertSharedPropertyType(spt: GatewaySharedPropertyType): SharedPropertyType | undefined;
12
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,0BAA0B,aAAc;UAM5C,0BAA0B;CAClC;CACA;CACA;CACA,UAAU;EAAE;;CAAsC;AACnD;AAED,OAAO,iBAAS,0BACdA,KAAK,4BACJ","names":["spt: GatewaySharedPropertyType"],"sources":["../../../src/generate/convertSharedPropertyType.ts"],"version":3,"file":"convertSharedPropertyType.d.ts"}
@@ -0,0 +1,15 @@
1
+ type ActionParameterType = string | {
2
+ type: string
3
+ [key: string]: unknown
4
+ };
5
+ /**
6
+ * Maps a gateway ActionParameterType (discriminated union from OntologyFullMetadata)
7
+ * to a maker ActionParameterType (string primitives or complex objects).
8
+ *
9
+ * Returns undefined for unsupported types (with a warning).
10
+ */
11
+ export declare function mapActionParameterType(dataType: {
12
+ type: string
13
+ [key: string]: unknown
14
+ }): ActionParameterType | undefined;
15
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"KAoBK,+BAA+B;CAAE;;AAAsC;;;;;;;AAgG5E,OAAO,iBAAS,uBACdA,UAAU;CAAE;;AAAsC,IACjD","names":["dataType: { type: string; [key: string]: unknown }"],"sources":["../../../src/generate/mapActionParameterType.ts"],"version":3,"file":"mapActionParameterType.d.ts"}
@@ -0,0 +1,19 @@
1
+ import type { PropertyTypeType } from "@osdk/maker";
2
+ /**
3
+ * Result of mapping a gateway ObjectPropertyType to a maker PropertyTypeType.
4
+ * `array` is true when the gateway type was {type: "array", subType: X}.
5
+ */
6
+ export interface MappedPropertyType {
7
+ type: PropertyTypeType;
8
+ array?: boolean;
9
+ }
10
+ /**
11
+ * Maps a gateway ObjectPropertyType (discriminated union with {type: string})
12
+ * to a maker PropertyTypeType.
13
+ *
14
+ * Returns undefined for unsupported types (with a warning).
15
+ */
16
+ export declare function mapPropertyType(dataType: {
17
+ type: string
18
+ [key: string]: unknown
19
+ }): MappedPropertyType | undefined;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,wBAAwB,aAAc;;;;;AAOpD,iBAAiB,mBAAmB;CAClC,MAAM;CACN;AACD;;;;;;;AAQD,OAAO,iBAAS,gBACdA,UAAU;CAAE;;AAAsC,IACjD","names":["dataType: { type: string; [key: string]: unknown }"],"sources":["../../../src/generate/mapPropertyType.ts"],"version":3,"file":"mapPropertyType.d.ts"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Strips namespace prefix from an apiName.
3
+ * "com.example.Employee" -> "Employee"
4
+ * "Employee" -> "Employee"
5
+ */
6
+ export declare function withoutNamespace(apiName: string): string;
7
+ /**
8
+ * Converts a dot-separated apiName to camelCase, including namespace segments.
9
+ * "com.example.Employee" -> "comExampleEmployee"
10
+ * "Employee" -> "employee"
11
+ */
12
+ export declare function fullCamel(apiName: string): string;
13
+ /**
14
+ * Converts an apiName to camelCase variable name.
15
+ * "Employee" -> "employee"
16
+ * "create-employee" -> "createEmployee"
17
+ */
18
+ export declare function camel(str: string): string;
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAqBA,OAAO,iBAAS,iBAAiBA;;;;;;AAajC,OAAO,iBAAS,UAAUA;;;;;;AAS1B,OAAO,iBAAS,MAAMC","names":["apiName: string","str: string"],"sources":["../../../src/generate/utils.ts"],"version":3,"file":"utils.d.ts"}
@@ -0,0 +1,94 @@
1
+ interface OntologyFullMetadata {
2
+ objectTypes: Record<string, {
3
+ objectType: {
4
+ apiName: string
5
+ displayName?: string
6
+ description?: string
7
+ primaryKey: string
8
+ titleProperty: string
9
+ status: string
10
+ visibility?: string
11
+ properties: Record<string, {
12
+ displayName?: string
13
+ description?: string
14
+ dataType: {
15
+ type: string
16
+ [key: string]: unknown
17
+ }
18
+ }>
19
+ }
20
+ sharedPropertyTypeMapping?: Record<string, string>
21
+ }>;
22
+ actionTypes: Record<string, {
23
+ apiName: string
24
+ displayName?: string
25
+ description?: string
26
+ status: string
27
+ parameters: Record<string, {
28
+ displayName?: string
29
+ description?: string
30
+ dataType: {
31
+ type: string
32
+ [key: string]: unknown
33
+ }
34
+ required: boolean
35
+ }>
36
+ operations: Array<{
37
+ type: string
38
+ [key: string]: unknown
39
+ }>
40
+ }>;
41
+ interfaceTypes: Record<string, {
42
+ apiName: string
43
+ displayName?: string
44
+ description?: string
45
+ extendsInterfaces: ReadonlyArray<string>
46
+ properties: Record<string, {
47
+ apiName: string
48
+ displayName?: string
49
+ description?: string
50
+ dataType: {
51
+ type: string
52
+ [key: string]: unknown
53
+ }
54
+ }>
55
+ links: Record<string, {
56
+ apiName: string
57
+ displayName?: string
58
+ description?: string
59
+ cardinality: string
60
+ required: boolean
61
+ linkedEntityApiName: {
62
+ type: string
63
+ apiName?: string
64
+ }
65
+ }>
66
+ }>;
67
+ sharedPropertyTypes: Record<string, {
68
+ apiName: string
69
+ displayName?: string
70
+ description?: string
71
+ dataType: {
72
+ type: string
73
+ [key: string]: unknown
74
+ }
75
+ }>;
76
+ }
77
+ /**
78
+ * Resolves unique variable/file names for a list of apiNames.
79
+ *
80
+ * First tries the short name (namespace stripped, camelCase).
81
+ * If that collides, all colliding entries are escalated to the full
82
+ * camelCase name (namespace included). Any remaining duplicates get
83
+ * a numeric suffix.
84
+ */
85
+ export declare function resolveVarNames(apiNames: string[]): string[];
86
+ /**
87
+ * Generates TypeScript files from OntologyFullMetadata, replicating
88
+ * the pattern from maker's writeStaticObjects().
89
+ *
90
+ * Each entity gets its own file with wrapWithProxy, plus an index.ts
91
+ * that re-exports everything.
92
+ */
93
+ export declare function writeImportedOntology(metadata: OntologyFullMetadata, outputDir: string): void;
94
+ export {};
@@ -0,0 +1 @@
1
+ {"mappings":"UAyBU,qBAAqB;CAC7B,aAAa,eAAe;EAC1B,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACA;GACA,YAAY,eAEV;IACE;IACA;IACA,UAAU;KAAE;;IAAsC;GACnD;EAEJ;EACD,4BAA4B;CAC7B;CACD,aAAa,eAAe;EAC1B;EACA;EACA;EACA;EACA,YAAY,eAAe;GACzB;GACA;GACA,UAAU;IAAE;;GAAsC;GAClD;EACD;EACD,YAAY,MAAM;GAAE;;EAAsC;CAC3D;CACD,gBAAgB,eAAe;EAC7B;EACA;EACA;EACA,mBAAmB;EACnB,YAAY,eAAe;GACzB;GACA;GACA;GACA,UAAU;IAAE;;GAAsC;EACnD;EACD,OAAO,eAAe;GACpB;GACA;GACA;GACA;GACA;GACA,qBAAqB;IAAE;IAAc;GAAkB;EACxD;CACF;CACD,qBAAqB,eAAe;EAClC;EACA;EACA;EACA,UAAU;GAAE;;EAAsC;CACnD;AACF;;;;;;;;;AA8BD,OAAO,iBAAS,gBAAgBA;;;;;;;;AAoChC,OAAO,iBAAS,sBACdC,UAAU,sBACVC","names":["apiNames: string[]","metadata: OntologyFullMetadata","outputDir: string"],"sources":["../../../src/generate/writeImportedOntology.ts"],"version":3,"file":"writeImportedOntology.d.ts"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./cli/main.js";
2
+ export { writeImportedOntology } from "./generate/writeImportedOntology.js";
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,SAAS,eAA0B;AACnC,SAAS,6BAA6B","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/maker-import",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "consola": "^3.4.2",
31
31
  "yargs": "^17.7.2",
32
- "@osdk/maker": "~0.18.0"
32
+ "@osdk/maker": "~0.19.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^20.19.13",