@osdk/maker 0.13.0-beta.4 → 0.13.0-beta.5
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 +11 -0
- package/build/browser/api/defineOntology.js +32 -108
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/defineValueType.js +2 -1
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/markingconstraint.test.js +3 -3
- package/build/browser/api/markingconstraint.test.js.map +1 -1
- package/build/browser/api/objectStatus.test.js +4 -4
- package/build/browser/api/objectStatus.test.js.map +1 -1
- package/build/browser/api/overall.test.js +496 -268
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/propertyConversionUtils.js +3 -1
- package/build/browser/api/propertyConversionUtils.js.map +1 -1
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +11 -5
- package/build/browser/cli/main.js.map +1 -1
- package/build/cjs/index.cjs +49 -116
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +6 -9
- package/build/esm/api/defineOntology.js +32 -108
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/defineValueType.js +2 -1
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/markingconstraint.test.js +3 -3
- package/build/esm/api/markingconstraint.test.js.map +1 -1
- package/build/esm/api/objectStatus.test.js +4 -4
- package/build/esm/api/objectStatus.test.js.map +1 -1
- package/build/esm/api/overall.test.js +496 -268
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/propertyConversionUtils.js +3 -1
- package/build/esm/api/propertyConversionUtils.js.map +1 -1
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +11 -5
- package/build/esm/cli/main.js.map +1 -1
- package/build/types/api/defineOntology.d.ts +1 -6
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts +2 -2
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/propertyConversionUtils.d.ts +2 -2
- package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
- package/build/types/api/types.d.ts +4 -13
- package/build/types/api/types.d.ts.map +1 -1
- package/package.json +8 -8
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionTypeApiName, ParameterId, OntologyIrBaseParameterType_decimal, OntologyIrBaseParameterType_decimalList, OntologyIrBaseParameterType_timestamp, OntologyIrBaseParameterType_timestampList, OntologyIrBaseParameterType_objectReference, OntologyIrBaseParameterType_objectReferenceList, OntologyIrBaseParameterType_objectSetRid, OntologyIrBaseParameterType_objectTypeReference, OntologyIrBaseParameterType_interfaceReference, OntologyIrBaseParameterType_interfaceReferenceList, OntologyIrBaseParameterType_struct, OntologyIrBaseParameterType_structList, OntologyIrLabelledValue, OntologyIrConditionValue, OntologyIrParameterDateRangeValue, InterfaceTypeApiName, OntologyIrCondition, OntologyIrParameterPrefill, OntologyIrLogicRule, SectionId, ActionTypeStatus_deprecated, OntologyIrActionTypeEntities, OntologyIrFormContent, OntologyIrValidationRule, DisplayMetadataConfigurationDefaultLayout, DisplayMetadataConfigurationDisplayAndFormat, ButtonDisplayMetadata, OntologyIrMarketplaceInterfaceType, StructFieldType,
|
|
1
|
+
import { ActionTypeApiName, ParameterId, OntologyIrBaseParameterType_decimal, OntologyIrBaseParameterType_decimalList, OntologyIrBaseParameterType_timestamp, OntologyIrBaseParameterType_timestampList, OntologyIrBaseParameterType_objectReference, OntologyIrBaseParameterType_objectReferenceList, OntologyIrBaseParameterType_objectSetRid, OntologyIrBaseParameterType_objectTypeReference, OntologyIrBaseParameterType_interfaceReference, OntologyIrBaseParameterType_interfaceReferenceList, OntologyIrBaseParameterType_struct, OntologyIrBaseParameterType_structList, OntologyIrLabelledValue, OntologyIrConditionValue, OntologyIrParameterDateRangeValue, InterfaceTypeApiName, OntologyIrCondition, OntologyIrParameterPrefill, OntologyIrLogicRule, SectionId, ActionTypeStatus_deprecated, OntologyIrActionTypeEntities, OntologyIrFormContent, OntologyIrValidationRule, DisplayMetadataConfigurationDefaultLayout, DisplayMetadataConfigurationDisplayAndFormat, ButtonDisplayMetadata, OntologyIrMarketplaceInterfaceType, StructFieldType, OntologyIrValueTypeReferenceWithMetadata, Visibility, SharedPropertyTypeGothamMapping, InterfaceTypeStatus, OntologyIrPropertyType, ValueTypeApiName, ValueTypeDisplayMetadata, ValueTypeStatus, ValueTypeVersion, BaseType, ValueTypeDataConstraint, ExampleValue, ValidationRuleDisplayMetadata, OntologyIrLogicRuleValue_parameterId, OntologyIrLogicRuleValue_staticValue, OntologyIrLogicRuleValue_objectParameterPropertyValue, OntologyIrLogicRuleValue_interfaceParameterPropertyValue, OntologyIrLogicRuleValue_synchronousWebhookOutput, LinkTypeMetadata, OntologyIrLinkTypeStatus, DataConstraint, FailureMessage, OntologyIrObjectType, OntologyIr, OntologyIrType } from '@osdk/client.unstable';
|
|
2
2
|
|
|
3
3
|
declare function main(args?: string[]): Promise<void>;
|
|
4
4
|
|
|
@@ -282,7 +282,7 @@ interface InterfacePropertyType {
|
|
|
282
282
|
sharedPropertyType: SharedPropertyType;
|
|
283
283
|
required: boolean;
|
|
284
284
|
}
|
|
285
|
-
interface InterfaceType extends OntologyEntityBase, Omit<OntologyIrMarketplaceInterfaceType, "properties" | "
|
|
285
|
+
interface InterfaceType extends OntologyEntityBase, Omit<OntologyIrMarketplaceInterfaceType, "properties" | "propertiesV2" | "propertiesV3" | "extendsInterfaces"> {
|
|
286
286
|
propertiesV2: Record<string, InterfacePropertyType>;
|
|
287
287
|
extendsInterfaces: Array<InterfaceType>;
|
|
288
288
|
status: InterfaceTypeStatus;
|
|
@@ -293,7 +293,7 @@ interface PropertyType {
|
|
|
293
293
|
array?: boolean;
|
|
294
294
|
description?: string;
|
|
295
295
|
displayName?: string;
|
|
296
|
-
valueType?:
|
|
296
|
+
valueType?: OntologyIrValueTypeReferenceWithMetadata;
|
|
297
297
|
visibility?: Visibility;
|
|
298
298
|
typeClasses?: TypeClass[];
|
|
299
299
|
nullability?: Nullability;
|
|
@@ -581,6 +581,7 @@ interface ValueTypeType_timestamp {
|
|
|
581
581
|
type ValueTypeType = ValueTypeType_array | ValueTypeType_boolean | ValueTypeType_binary | ValueTypeType_byte | ValueTypeType_date | ValueTypeType_decimal | ValueTypeType_double | ValueTypeType_float | ValueTypeType_integer | ValueTypeType_long | ValueTypeType_map | ValueTypeType_optional | ValueTypeType_short | ValueTypeType_string | ValueTypeType_structV2 | ValueTypeType_timestamp;
|
|
582
582
|
type ValueTypeDefinitionVersion = OntologyEntityBase & {
|
|
583
583
|
apiName: ValueTypeApiName;
|
|
584
|
+
packageNamespace: string;
|
|
584
585
|
displayMetadata: ValueTypeDisplayMetadata;
|
|
585
586
|
status: ValueTypeStatus;
|
|
586
587
|
version: ValueTypeVersion;
|
|
@@ -678,11 +679,7 @@ declare function defineObject(objectDef: ObjectTypeDefinition): ObjectTypeDefini
|
|
|
678
679
|
declare function convertToDisplayName(s: string | undefined | null): string;
|
|
679
680
|
declare function convertToPluralDisplayName(s: string | undefined | null): string;
|
|
680
681
|
|
|
681
|
-
|
|
682
|
-
ontology: OntologyIr;
|
|
683
|
-
valueType: OntologyIrValueTypeBlockData;
|
|
684
|
-
};
|
|
685
|
-
declare function defineOntology(ns: string, body: () => void | Promise<void>, outputDir: string | undefined, dependencyFile?: string): Promise<OntologyAndValueTypeIrs>;
|
|
682
|
+
declare function defineOntology(ns: string, body: () => void | Promise<void>, outputDir: string | undefined, dependencyFile?: string): Promise<OntologyIr>;
|
|
686
683
|
declare function dumpOntologyFullMetadata(): OntologyIr;
|
|
687
684
|
declare function addNamespaceIfNone(apiName: string): string;
|
|
688
685
|
|
|
@@ -692,7 +689,7 @@ interface SharedPropertyTypeDefinition {
|
|
|
692
689
|
array?: boolean;
|
|
693
690
|
description?: string;
|
|
694
691
|
displayName?: string;
|
|
695
|
-
valueType?:
|
|
692
|
+
valueType?: OntologyIrValueTypeReferenceWithMetadata;
|
|
696
693
|
visibility?: Visibility;
|
|
697
694
|
typeClasses?: SharedPropertyType["typeClasses"];
|
|
698
695
|
gothamMapping?: SharedPropertyTypeGothamMapping;
|
|
@@ -79,10 +79,7 @@ export async function defineOntology(ns, body, outputDir, dependencyFile) {
|
|
|
79
79
|
if (dependencyFile) {
|
|
80
80
|
writeDependencyFile(dependencyFile);
|
|
81
81
|
}
|
|
82
|
-
return
|
|
83
|
-
ontology: convertToWireOntologyIr(ontologyDefinition),
|
|
84
|
-
valueType: convertOntologyToValueTypeIr(ontologyDefinition)
|
|
85
|
-
};
|
|
82
|
+
return convertToWireOntologyIr(ontologyDefinition);
|
|
86
83
|
}
|
|
87
84
|
export function writeStaticObjects(outputDir) {
|
|
88
85
|
const codegenDir = path.resolve(outputDir, "codegen");
|
|
@@ -148,111 +145,32 @@ export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFi
|
|
|
148
145
|
}
|
|
149
146
|
function convertOntologyToValueTypeIr(ontology) {
|
|
150
147
|
return {
|
|
151
|
-
valueTypes:
|
|
152
|
-
metadata: {
|
|
153
|
-
apiName: definitions[0].apiName,
|
|
154
|
-
displayMetadata: definitions[0].displayMetadata,
|
|
155
|
-
status: definitions[0].status
|
|
156
|
-
},
|
|
157
|
-
versions: definitions.map(definition => ({
|
|
158
|
-
version: definition.version,
|
|
159
|
-
baseType: definition.baseType,
|
|
160
|
-
constraints: definition.constraints,
|
|
161
|
-
exampleValues: definition.exampleValues
|
|
162
|
-
}))
|
|
163
|
-
}))
|
|
148
|
+
valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
|
|
164
149
|
};
|
|
165
150
|
}
|
|
166
|
-
function
|
|
167
|
-
return {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
151
|
+
function convertValueTypesToIr(valueTypes) {
|
|
152
|
+
return Object.values(valueTypes).map(definitions => ({
|
|
153
|
+
metadata: {
|
|
154
|
+
apiName: definitions[0].apiName,
|
|
155
|
+
packageNamespace: definitions[0].packageNamespace,
|
|
156
|
+
displayMetadata: definitions[0].displayMetadata,
|
|
157
|
+
status: definitions[0].status
|
|
158
|
+
},
|
|
159
|
+
// TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
|
|
160
|
+
versions: Array.from(new Map(definitions.map(definition => [definition.version, definition])).values()).map(definition => ({
|
|
161
|
+
version: definition.version,
|
|
162
|
+
baseType: definition.baseType,
|
|
163
|
+
constraints: definition.constraints,
|
|
164
|
+
exampleValues: definition.exampleValues
|
|
165
|
+
}))
|
|
166
|
+
}));
|
|
171
167
|
}
|
|
172
|
-
function
|
|
173
|
-
const asBlockData = convertToWireBlockData(importedTypes); // this just makes things easier to work with
|
|
168
|
+
function convertToWireOntologyIr(ontology) {
|
|
174
169
|
return {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
type: spt.sharedPropertyType.type,
|
|
180
|
-
valueType: spt.sharedPropertyType.valueType === undefined ? undefined : {
|
|
181
|
-
apiName: spt.sharedPropertyType.valueType.apiName,
|
|
182
|
-
version: spt.sharedPropertyType.valueType.version
|
|
183
|
-
}
|
|
184
|
-
})),
|
|
185
|
-
objectTypes: Object.values(asBlockData.objectTypes).map(ot => ({
|
|
186
|
-
apiName: ot.objectType.apiName,
|
|
187
|
-
displayName: ot.objectType.displayMetadata.displayName,
|
|
188
|
-
description: ot.objectType.displayMetadata.description,
|
|
189
|
-
propertyTypes: Object.values(ot.objectType.propertyTypes).map(p => ({
|
|
190
|
-
apiName: p.apiName,
|
|
191
|
-
displayName: p.displayMetadata.displayName,
|
|
192
|
-
description: p.displayMetadata.description,
|
|
193
|
-
type: p.type,
|
|
194
|
-
sharedPropertyType: p.sharedPropertyTypeApiName
|
|
195
|
-
}))
|
|
196
|
-
})),
|
|
197
|
-
interfaceTypes: Object.values(asBlockData.interfaceTypes).map(i => ({
|
|
198
|
-
apiName: i.interfaceType.apiName,
|
|
199
|
-
displayName: i.interfaceType.displayMetadata.displayName,
|
|
200
|
-
description: i.interfaceType.displayMetadata.description,
|
|
201
|
-
properties: Object.values(i.interfaceType.propertiesV2).map(p => ({
|
|
202
|
-
apiName: p.sharedPropertyType.apiName,
|
|
203
|
-
displayName: p.sharedPropertyType.displayMetadata.displayName,
|
|
204
|
-
description: p.sharedPropertyType.displayMetadata.description,
|
|
205
|
-
type: p.sharedPropertyType.type
|
|
206
|
-
})),
|
|
207
|
-
links: i.interfaceType.links.map(l => ({
|
|
208
|
-
apiName: l.metadata.apiName,
|
|
209
|
-
displayName: l.metadata.displayName,
|
|
210
|
-
description: l.metadata.description,
|
|
211
|
-
cardinality: l.cardinality,
|
|
212
|
-
required: l.required
|
|
213
|
-
}))
|
|
214
|
-
})),
|
|
215
|
-
actionTypes: Object.values(asBlockData.actionTypes).map(a => ({
|
|
216
|
-
apiName: a.actionType.metadata.apiName,
|
|
217
|
-
displayName: a.actionType.metadata.displayMetadata.displayName,
|
|
218
|
-
description: a.actionType.metadata.displayMetadata.description,
|
|
219
|
-
parameters: Object.values(a.actionType.metadata.parameters).map(p => ({
|
|
220
|
-
id: p.id,
|
|
221
|
-
displayName: p.displayMetadata.displayName,
|
|
222
|
-
description: p.displayMetadata.description,
|
|
223
|
-
type: p.type
|
|
224
|
-
}))
|
|
225
|
-
})),
|
|
226
|
-
linkTypes: Object.values(asBlockData.linkTypes).map(l => {
|
|
227
|
-
if (l.linkType.definition.type === "oneToMany") {
|
|
228
|
-
return {
|
|
229
|
-
id: l.linkType.id,
|
|
230
|
-
definition: {
|
|
231
|
-
type: "oneToMany",
|
|
232
|
-
"oneToMany": {
|
|
233
|
-
objectTypeApiNameOneSide: l.linkType.definition.oneToMany.objectTypeRidOneSide,
|
|
234
|
-
objectTypeApiNameManySide: l.linkType.definition.oneToMany.objectTypeRidManySide,
|
|
235
|
-
manyToOneLinkDisplayName: l.linkType.definition.oneToMany.manyToOneLinkMetadata.displayMetadata.displayName,
|
|
236
|
-
oneToManyLinkDisplayName: l.linkType.definition.oneToMany.oneToManyLinkMetadata.displayMetadata.displayName,
|
|
237
|
-
cardinality: l.linkType.definition.oneToMany.cardinalityHint
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
} else {
|
|
242
|
-
return {
|
|
243
|
-
id: l.linkType.id,
|
|
244
|
-
definition: {
|
|
245
|
-
type: "manyToMany",
|
|
246
|
-
"manyToMany": {
|
|
247
|
-
objectTypeApiNameA: l.linkType.definition.manyToMany.objectTypeRidA,
|
|
248
|
-
objectTypeApiNameB: l.linkType.definition.manyToMany.objectTypeRidB,
|
|
249
|
-
objectTypeAToBLinkDisplayName: l.linkType.definition.manyToMany.objectTypeAToBLinkMetadata.displayMetadata.displayName,
|
|
250
|
-
objectTypeBToALinkDisplayName: l.linkType.definition.manyToMany.objectTypeBToALinkMetadata.displayMetadata.displayName
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
})
|
|
170
|
+
ontology: convertToWireBlockData(ontology),
|
|
171
|
+
importedOntology: convertToWireBlockData(importedTypes),
|
|
172
|
+
valueTypes: convertOntologyToValueTypeIr(ontology),
|
|
173
|
+
importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
|
|
256
174
|
};
|
|
257
175
|
}
|
|
258
176
|
function convertToWireBlockData(ontology) {
|
|
@@ -622,11 +540,15 @@ function convertInterface(interfaceType) {
|
|
|
622
540
|
required: spt.required,
|
|
623
541
|
sharedPropertyType: convertSpt(spt.sharedPropertyType)
|
|
624
542
|
}])),
|
|
543
|
+
displayMetadata: {
|
|
544
|
+
displayName: interfaceType.displayMetadata.displayName,
|
|
545
|
+
description: interfaceType.displayMetadata.description
|
|
546
|
+
},
|
|
625
547
|
extendsInterfaces: interfaceType.extendsInterfaces.map(i => i.apiName),
|
|
626
548
|
// these are omitted from our internal types but we need to re-add them for the final json
|
|
549
|
+
properties: [],
|
|
627
550
|
// TODO(mwalther): Support propertiesV3
|
|
628
|
-
propertiesV3: {}
|
|
629
|
-
properties: []
|
|
551
|
+
propertiesV3: {}
|
|
630
552
|
};
|
|
631
553
|
}
|
|
632
554
|
export function dumpOntologyFullMetadata() {
|
|
@@ -672,7 +594,9 @@ function convertSpt({
|
|
|
672
594
|
typeClasses: typeClasses ?? [],
|
|
673
595
|
valueType: valueType === undefined ? undefined : {
|
|
674
596
|
apiName: valueType.apiName,
|
|
675
|
-
version: valueType.version
|
|
597
|
+
version: valueType.version,
|
|
598
|
+
packageNamespace: valueType.packageNamespace,
|
|
599
|
+
displayMetadata: valueType.displayMetadata
|
|
676
600
|
}
|
|
677
601
|
};
|
|
678
602
|
}
|