@osdk/maker 0.10.0-beta.14 → 0.10.0-beta.16

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/build/browser/api/defineAction.js +77 -0
  3. package/build/browser/api/defineAction.js.map +1 -0
  4. package/build/browser/api/defineObject.js +10 -0
  5. package/build/browser/api/defineObject.js.map +1 -1
  6. package/build/browser/api/defineOntology.js +387 -13
  7. package/build/browser/api/defineOntology.js.map +1 -1
  8. package/build/browser/api/defineSpt.js.map +1 -1
  9. package/build/browser/api/overall.test.js +485 -0
  10. package/build/browser/api/overall.test.js.map +1 -1
  11. package/build/browser/api/types.js.map +1 -1
  12. package/build/browser/cli/main.js +1 -1
  13. package/build/browser/index.js +2 -0
  14. package/build/browser/index.js.map +1 -1
  15. package/build/cjs/index.cjs +529 -94
  16. package/build/cjs/index.cjs.map +1 -1
  17. package/build/cjs/index.d.cts +107 -8
  18. package/build/esm/api/defineAction.js +77 -0
  19. package/build/esm/api/defineAction.js.map +1 -0
  20. package/build/esm/api/defineObject.js +10 -0
  21. package/build/esm/api/defineObject.js.map +1 -1
  22. package/build/esm/api/defineOntology.js +387 -13
  23. package/build/esm/api/defineOntology.js.map +1 -1
  24. package/build/esm/api/defineSpt.js.map +1 -1
  25. package/build/esm/api/overall.test.js +485 -0
  26. package/build/esm/api/overall.test.js.map +1 -1
  27. package/build/esm/api/types.js.map +1 -1
  28. package/build/esm/cli/main.js +1 -1
  29. package/build/esm/index.js +2 -0
  30. package/build/esm/index.js.map +1 -1
  31. package/build/types/api/defineAction.d.ts +2 -0
  32. package/build/types/api/defineAction.d.ts.map +1 -0
  33. package/build/types/api/defineObject.d.ts +2 -1
  34. package/build/types/api/defineObject.d.ts.map +1 -1
  35. package/build/types/api/defineOntology.d.ts.map +1 -1
  36. package/build/types/api/defineSpt.d.ts +2 -1
  37. package/build/types/api/defineSpt.d.ts.map +1 -1
  38. package/build/types/api/types.d.ts +98 -8
  39. package/build/types/api/types.d.ts.map +1 -1
  40. package/build/types/index.d.ts +2 -0
  41. package/build/types/index.d.ts.map +1 -1
  42. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @osdk/maker
2
2
 
3
+ ## 0.10.0-beta.16
4
+
5
+ ### Minor Changes
6
+
7
+ - 4a02a1f: Make string more configurable
8
+ - c0aa106: Add visibility field to shared property type in maker
9
+ - 395ae07: Actions as code
10
+ - c7f7a99: Export defineOntology method
11
+
12
+ ### Patch Changes
13
+
14
+ - @osdk/api@2.2.0-beta.16
15
+
16
+ ## 0.10.0-beta.15
17
+
18
+ ### Minor Changes
19
+
20
+ - 24c4b12: Add geotime and mediaset datasources to OAC
21
+ - cc380b5: Use the latest Platform APIs
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [ed69666]
26
+ - @osdk/api@2.2.0-beta.15
27
+
3
28
  ## 0.10.0-beta.14
4
29
 
5
30
  ### Minor Changes
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import invariant from "tiny-invariant";
18
+ import { namespace, ontologyDefinition } from "./defineOntology.js";
19
+ export function defineAction(actionDef) {
20
+ const apiName = namespace + actionDef.apiName;
21
+ const parameterIds = (actionDef.parameters ?? []).map(p => p.id);
22
+ if (ontologyDefinition.actionTypes[apiName] !== undefined) {
23
+ throw new Error(`Action type with apiName ${actionDef.apiName} is already defined`);
24
+ }
25
+ !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(actionDef.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Action type apiName "${actionDef.apiName}" must be alphanumeric, lowercase, and kebab-case`) : invariant(false) : void 0;
26
+ const parameterIdsSet = new Set(parameterIds);
27
+ !(parameterIdsSet.size === parameterIds.length) ? process.env.NODE_ENV !== "production" ? invariant(false, `Parameter ids must be unique`) : invariant(false) : void 0;
28
+ const parameterIdsNotFound = Array.from(referencedParameterIds(actionDef)).filter(p => !parameterIdsSet.has(p));
29
+ !(parameterIdsNotFound.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, `Parameters [${parameterIdsNotFound}] were referenced but not defined`) : invariant(false) : void 0;
30
+ const definedSectionIds = new Set(Object.keys(actionDef.sections ?? []));
31
+ const undefinedSectionsInOrdering = (actionDef.formContentOrdering ?? []).flatMap(s => s.type === "parameterId" ? [] : [s.sectionId]).filter(sId => !definedSectionIds.has(sId));
32
+ !(undefinedSectionsInOrdering.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, `Sections [${undefinedSectionsInOrdering}] were referenced in content ordering but not defined`) : invariant(false) : void 0;
33
+ !(actionDef.rules.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, `Action type ${actionDef.apiName} must have at least one logic rule`) : invariant(false) : void 0;
34
+ const fullAction = {
35
+ ...actionDef,
36
+ apiName: apiName
37
+ };
38
+ ontologyDefinition.actionTypes[apiName] = fullAction;
39
+ return fullAction;
40
+ }
41
+ function referencedParameterIds(actionDef) {
42
+ const parameterIds = new Set();
43
+
44
+ // section definitions
45
+ Object.values(actionDef.sections ?? {}).flatMap(p => p).forEach(pId => parameterIds.add(pId));
46
+
47
+ // form content ordering
48
+ (actionDef.formContentOrdering ?? []).forEach(item => {
49
+ if (item.type === "parameterId") {
50
+ parameterIds.add(item.parameterId);
51
+ }
52
+ });
53
+
54
+ // logic rules
55
+ actionDef.rules.forEach(rule => {
56
+ switch (rule.type) {
57
+ case "addInterfaceRule":
58
+ parameterIds.add(rule.addInterfaceRule.objectType);
59
+ Object.values(rule.addInterfaceRule.sharedPropertyValues).forEach(v => {
60
+ if (v.type === "parameterId") {
61
+ parameterIds.add(v.parameterId);
62
+ }
63
+ });
64
+ break;
65
+ case "modifyInterfaceRule":
66
+ parameterIds.add(rule.modifyInterfaceRule.interfaceObjectToModify);
67
+ Object.values(rule.modifyInterfaceRule.sharedPropertyValues).forEach(v => {
68
+ if (v.type === "parameterId") {
69
+ parameterIds.add(v.parameterId);
70
+ }
71
+ });
72
+ break;
73
+ }
74
+ });
75
+ return parameterIds;
76
+ }
77
+ //# sourceMappingURL=defineAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineAction.js","names":["invariant","namespace","ontologyDefinition","defineAction","actionDef","apiName","parameterIds","parameters","map","p","id","actionTypes","undefined","Error","test","process","env","NODE_ENV","parameterIdsSet","Set","size","length","parameterIdsNotFound","Array","from","referencedParameterIds","filter","has","definedSectionIds","Object","keys","sections","undefinedSectionsInOrdering","formContentOrdering","flatMap","s","type","sectionId","sId","rules","fullAction","values","forEach","pId","add","item","parameterId","rule","addInterfaceRule","objectType","sharedPropertyValues","v","modifyInterfaceRule","interfaceObjectToModify"],"sources":["defineAction.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ParameterId } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport type { ActionType } from \"./types.js\";\n\nexport function defineAction(actionDef: ActionType): ActionType {\n const apiName = namespace + actionDef.apiName;\n const parameterIds = (actionDef.parameters ?? []).map(p => p.id);\n\n if (ontologyDefinition.actionTypes[apiName] !== undefined) {\n throw new Error(\n `Action type with apiName ${actionDef.apiName} is already defined`,\n );\n }\n invariant(\n /^[a-z0-9]+(-[a-z0-9]+)*$/.test(actionDef.apiName),\n `Action type apiName \"${actionDef.apiName}\" must be alphanumeric, lowercase, and kebab-case`,\n );\n\n const parameterIdsSet = new Set(parameterIds);\n invariant(\n parameterIdsSet.size === parameterIds.length,\n `Parameter ids must be unique`,\n );\n\n const parameterIdsNotFound = Array.from(referencedParameterIds(actionDef))\n .filter(p => !parameterIdsSet.has(p));\n invariant(\n parameterIdsNotFound.length === 0,\n `Parameters [${parameterIdsNotFound}] were referenced but not defined`,\n );\n\n const definedSectionIds = new Set(Object.keys(actionDef.sections ?? []));\n const undefinedSectionsInOrdering = (actionDef.formContentOrdering ?? [])\n .flatMap(\n s => s.type === \"parameterId\" ? [] : [s.sectionId],\n ).filter(sId => !definedSectionIds.has(sId));\n invariant(\n undefinedSectionsInOrdering.length === 0,\n `Sections [${undefinedSectionsInOrdering}] were referenced in content ordering but not defined`,\n );\n\n invariant(\n actionDef.rules.length > 0,\n `Action type ${actionDef.apiName} must have at least one logic rule`,\n );\n\n const fullAction = { ...actionDef, apiName: apiName };\n ontologyDefinition.actionTypes[apiName] = fullAction;\n return fullAction;\n}\n\nfunction referencedParameterIds(actionDef: ActionType): Set<ParameterId> {\n const parameterIds: Set<ParameterId> = new Set();\n\n // section definitions\n Object.values(actionDef.sections ?? {})\n .flatMap(p => p).forEach(pId => parameterIds.add(pId));\n\n // form content ordering\n (actionDef.formContentOrdering ?? []).forEach(item => {\n if (item.type === \"parameterId\") {\n parameterIds.add(item.parameterId);\n }\n });\n\n // logic rules\n actionDef.rules.forEach(rule => {\n switch (rule.type) {\n case \"addInterfaceRule\":\n parameterIds.add(rule.addInterfaceRule.objectType);\n Object.values(rule.addInterfaceRule.sharedPropertyValues).forEach(v => {\n if (v.type === \"parameterId\") {\n parameterIds.add(v.parameterId);\n }\n });\n break;\n case \"modifyInterfaceRule\":\n parameterIds.add(rule.modifyInterfaceRule.interfaceObjectToModify);\n Object.values(rule.modifyInterfaceRule.sharedPropertyValues).forEach(\n v => {\n if (v.type === \"parameterId\") {\n parameterIds.add(v.parameterId);\n }\n },\n );\n break;\n }\n });\n return parameterIds;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AAGnE,OAAO,SAASC,YAAYA,CAACC,SAAqB,EAAc;EAC9D,MAAMC,OAAO,GAAGJ,SAAS,GAAGG,SAAS,CAACC,OAAO;EAC7C,MAAMC,YAAY,GAAG,CAACF,SAAS,CAACG,UAAU,IAAI,EAAE,EAAEC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,EAAE,CAAC;EAEhE,IAAIR,kBAAkB,CAACS,WAAW,CAACN,OAAO,CAAC,KAAKO,SAAS,EAAE;IACzD,MAAM,IAAIC,KAAK,CACb,4BAA4BT,SAAS,CAACC,OAAO,qBAC/C,CAAC;EACH;EACA,CACE,0BAA0B,CAACS,IAAI,CAACV,SAAS,CAACC,OAAO,CAAC,GAAAU,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADpDjB,SAAS,QAEP,wBAAwBI,SAAS,CAACC,OAAO,mDAAmD,IAF9FL,SAAS;EAKT,MAAMkB,eAAe,GAAG,IAAIC,GAAG,CAACb,YAAY,CAAC;EAC7C,EACEY,eAAe,CAACE,IAAI,KAAKd,YAAY,CAACe,MAAM,IAAAN,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD9CjB,SAAS,QAEP,8BAA8B,IAFhCA,SAAS;EAKT,MAAMsB,oBAAoB,GAAGC,KAAK,CAACC,IAAI,C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List":[]}
@@ -30,6 +30,8 @@ export function defineObject(objectDef) {
30
30
  !(nonExistentPrimaryKeys.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, `Primary key properties ${nonExistentPrimaryKeys} do not exist on object ${objectDef.apiName}`) : invariant(false) : void 0;
31
31
  const retentionPeriod = objectDef.datasource?.retentionPeriod;
32
32
  !(retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Retention period "${retentionPeriod}" on object "${objectDef.apiName}" is not a valid ISO 8601 duration string`) : invariant(false) : void 0;
33
+ !(objectDef.properties ?? []).filter(p => p.apiName === objectDef.titlePropertyApiName).every(p => !isExotic(p.type)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Title property ${objectDef.titlePropertyApiName} must be a primitive type`) : invariant(false) : void 0;
34
+ !(objectDef.properties ?? []).filter(p => objectDef.primaryKeys.includes(p.apiName)).every(p => !isExotic(p.type)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Primary key properties ${objectDef.primaryKeys} can only be primitive types`) : invariant(false) : void 0;
33
35
  objectDef.implementsInterfaces?.forEach(interfaceImpl => {
34
36
  const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map(val => val.interfaceProperty).filter(interfaceProperty => interfaceImpl.implements.propertiesV2[interfaceProperty] === undefined).map(interfaceProp => ({
35
37
  type: "invalid",
@@ -59,6 +61,14 @@ export function defineObject(objectDef) {
59
61
  apiName: apiName
60
62
  };
61
63
  }
64
+ export function isExotic(type) {
65
+ if (typeof type === "string") {
66
+ return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
67
+ } else if (typeof type === "object" && type != null) {
68
+ return type.type === "marking" || type.type === "struct";
69
+ }
70
+ return false;
71
+ }
62
72
  function formatValidationErrors(error) {
63
73
  return `Ontology Definition Error: ${error.reason}\n`;
64
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"defineObject.js","names":["invariant","namespace","ontologyDefinition","ISO_8601_DURATION","defineObject","objectDef","apiName","propertyApiNames","properties","map","val","objectTypes","undefined","Error","includes","titlePropertyApiName","process","env","NODE_ENV","primaryKeys","length","nonExistentPrimaryKeys","filter","primaryKey","retentionPeriod","datasource","test","implementsInterfaces","forEach","interfaceImpl","nonExistentInterfaceProperties","propertyMapping","interfaceProperty","implements","propertiesV2","interfaceProp","type","reason","interfaceToObjectProperties","Object","fromEntries","mapping","mapsTo","validateProperty","sharedPropertyType","nonNameSpacedApiName","validateInterfaceImplProperty","baseValidations","entries","extendsValidations","extendsInterfaces","flatMap","interfaceApiName","interfaceTypes","allFailedValidations","concat","formatValidationErrors","join","error","spt","mappedObjectProp","object","objProp","find","prop"],"sources":["defineObject.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport type {\n InterfacePropertyType,\n ObjectType,\n SharedPropertyType,\n} from \"./types.js\";\n\n// From https://stackoverflow.com/a/79288714\nconst ISO_8601_DURATION =\n /^P(?!$)(?:(?:((?:\\d+Y)|(?:\\d+(?:\\.|,)\\d+Y$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+D)|(?:\\d+(?:\\.|,)\\d+D$))?(T((?:\\d+H)|(?:\\d+(?:\\.|,)\\d+H$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+S)|(?:\\d+(?:\\.|,)\\d+S$))?)?)|(?:\\d+(?:(?:\\.|,)\\d+)?W))$/;\n\nexport function defineObject(objectDef: ObjectType): ObjectType {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = (objectDef.properties ?? []).map(val => val.apiName);\n if (ontologyDefinition.objectTypes[apiName] !== undefined) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n objectDef.primaryKeys.length !== 0,\n `${objectDef.apiName} does not have any primary keys, objects must have at least one primary key`,\n );\n const nonExistentPrimaryKeys = objectDef.primaryKeys.filter(primaryKey =>\n !objectDef.properties?.map(val => val.apiName).includes(primaryKey)\n );\n invariant(\n nonExistentPrimaryKeys.length === 0,\n `Primary key properties ${nonExistentPrimaryKeys} do not exist on object ${objectDef.apiName}`,\n );\n const retentionPeriod = (objectDef.datasource as any)?.retentionPeriod;\n invariant(\n retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod),\n `Retention period \"${retentionPeriod}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 duration string`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n interfaceImpl.implements.propertiesV2[interfaceProperty]\n === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceImpl.implements.apiName}.${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [mapping.interfaceProperty, mapping.mapsTo],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, InterfacePropertyType],\n ): ValidationResult => {\n if (\n interfaceProp[1].sharedPropertyType.nonNameSpacedApiName\n in interfaceToObjectProperties\n ) {\n return validateInterfaceImplProperty(\n interfaceProp[1].sharedPropertyType,\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason: `Interface property ${interfaceImpl.implements.apiName}.${\n interfaceProp[1].sharedPropertyType.nonNameSpacedApiName\n } not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const baseValidations = Object.entries(\n interfaceImpl.implements.propertiesV2,\n )\n .map<ValidationResult>(validateProperty);\n const extendsValidations = interfaceImpl.implements.extendsInterfaces\n .flatMap(interfaceApiName =>\n Object.entries(\n ontologyDefinition.interfaceTypes[interfaceApiName].propertiesV2,\n ).map(validateProperty)\n );\n\n const allFailedValidations = baseValidations.concat(\n extendsValidations,\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n ontologyDefinition.objectTypes[apiName] = { ...objectDef, apiName: apiName };\n return { ...objectDef, apiName: apiName };\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n spt: SharedPropertyType,\n mappedObjectProp: string,\n object: ObjectType,\n): ValidationResult {\n const objProp = object.properties?.find(prop =>\n prop.apiName === mappedObjectProp\n );\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n if (spt.type !== objProp?.type) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,S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AAO,GAAGD,MAAM,CAACrD,UAAU,EAAEuD,IAAI,CAACC,IAAI,IAC1CA,IAAI,CAAC1D,OAAO,KAAKsD,gBACnB,CAAC;EACD,IAAIE,OAAO,KAAKlD,SAAS,EAAE;IACzB,OAAO;MACLwB,IAAI,EAAE,SAAS;MACfC,MAAM,EACJ,+EAA+EuB,gBAAgB;IACnG,CAAC;EACH;EACA,IAAID,GAAG,CAACvB,IAAI,KAAK0B,OAAO,EAAE1B,IAAI,EAAE;IAC9B,OAAO;MACLA,IAAI,EAAE,SAAS;MACfC,MAAM,EACJ,mGAAmGsB,GAAG,CAACrD,OAAO,qBAAqBsD,gBAAgB;IACvJ,CAAC;EACH;EAEA,OAAO;IAAExB,IAAI,EAAE;EAAQ,CAAC;AAC1B","ignoreList":[]}
1
+ {"version":3,"file":"defineObject.js","names":["invariant","namespace","ontologyDefinition","ISO_8601_DURATION","defineObject","objectDef","apiName","propertyApiNames","properties","map","val","objectTypes","undefined","Error","includes","titlePropertyApiName","process","env","NODE_ENV","primaryKeys","length","nonExistentPrimaryKeys","filter","primaryKey","retentionPeriod","datasource","test","p","every","isExotic","type","implementsInterfaces","forEach","interfaceImpl","nonExistentInterfaceProperties","propertyMapping","interfaceProperty","implements","propertiesV2","interfaceProp","reason","interfaceToObjectProperties","Object","fromEntries","mapping","mapsTo","validateProperty","sharedPropertyType","nonNameSpacedApiName","validateInterfaceImplProperty","baseValidations","entries","extendsValidations","extendsInterfaces","flatMap","interfaceApiName","interfaceTypes","allFailedValidations","concat","formatValidationErrors","join","error","spt","mappedObjectProp","object","objProp","find","prop"],"sources":["defineObject.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport type {\n InterfacePropertyType,\n ObjectType,\n PropertyTypeType,\n PropertyTypeTypeExotic,\n SharedPropertyType,\n} from \"./types.js\";\n\n// From https://stackoverflow.com/a/79288714\nconst ISO_8601_DURATION =\n /^P(?!$)(?:(?:((?:\\d+Y)|(?:\\d+(?:\\.|,)\\d+Y$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+D)|(?:\\d+(?:\\.|,)\\d+D$))?(T((?:\\d+H)|(?:\\d+(?:\\.|,)\\d+H$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+S)|(?:\\d+(?:\\.|,)\\d+S$))?)?)|(?:\\d+(?:(?:\\.|,)\\d+)?W))$/;\n\nexport function defineObject(objectDef: ObjectType): ObjectType {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = (objectDef.properties ?? []).map(val => val.apiName);\n if (ontologyDefinition.objectTypes[apiName] !== undefined) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n objectDef.primaryKeys.length !== 0,\n `${objectDef.apiName} does not have any primary keys, objects must have at least one primary key`,\n );\n const nonExistentPrimaryKeys = objectDef.primaryKeys.filter(primaryKey =>\n !objectDef.properties?.map(val => val.apiName).includes(primaryKey)\n );\n invariant(\n nonExistentPrimaryKeys.length === 0,\n `Primary key properties ${nonExistentPrimaryKeys} do not exist on object ${objectDef.apiName}`,\n );\n const retentionPeriod = (objectDef.datasource as any)?.retentionPeriod;\n invariant(\n retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod),\n `Retention period \"${retentionPeriod}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 duration string`,\n );\n invariant(\n (objectDef.properties ?? []).filter(p =>\n p.apiName === objectDef.titlePropertyApiName\n ).every(p => !isExotic(p.type)),\n `Title property ${objectDef.titlePropertyApiName} must be a primitive type`,\n );\n invariant(\n (objectDef.properties ?? []).filter(p =>\n objectDef.primaryKeys.includes(p.apiName)\n ).every(p => !isExotic(p.type)),\n `Primary key properties ${objectDef.primaryKeys} can only be primitive types`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n interfaceImpl.implements.propertiesV2[interfaceProperty]\n === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceImpl.implements.apiName}.${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [mapping.interfaceProperty, mapping.mapsTo],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, InterfacePropertyType],\n ): ValidationResult => {\n if (\n interfaceProp[1].sharedPropertyType.nonNameSpacedApiName\n in interfaceToObjectProperties\n ) {\n return validateInterfaceImplProperty(\n interfaceProp[1].sharedPropertyType,\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason: `Interface property ${interfaceImpl.implements.apiName}.${\n interfaceProp[1].sharedPropertyType.nonNameSpacedApiName\n } not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const baseValidations = Object.entries(\n interfaceImpl.implements.propertiesV2,\n )\n .map<ValidationResult>(validateProperty);\n const extendsValidations = interfaceImpl.implements.extendsInterfaces\n .flatMap(interfaceApiName =>\n Object.entries(\n ontologyDefinition.interfaceTypes[interfaceApiName].propertiesV2,\n ).map(validateProperty)\n );\n\n const allFailedValidations = baseValidations.concat(\n extendsValidations,\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n ontologyDefinition.objectTypes[apiName] = { ...objectDef, apiName: apiName };\n return { ...objectDef, apiName: apiName };\n}\n\nexport function isExotic(\n type: PropertyTypeType,\n): type is PropertyTypeTypeExotic {\n if (typeof type === \"string\") {\n return [\"geopoint\", \"geoshape\", \"mediaReference\", \"geotimeSeries\"].includes(\n type,\n );\n } else if (typeof type === \"object\" && type != null) {\n return type.type === \"marking\" || type.type === \"struct\";\n }\n return false;\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n spt: SharedPropertyType,\n mappedObjectProp: string,\n object: ObjectType,\n): ValidationResult {\n const objProp = object.properties?.find(prop =>\n prop.apiName === mappedObjectProp\n );\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n if (spt.type !== objProp?.type) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AASnE;AACA,MAAMC,iBAAiB,GACrB,+OAA+O;AAEjP,OAAO,SAASC,YAAYA,CAACC,SAAqB,EAAc;EAC9D,MAAMC,OAAO,GAAGL,SAAS,GAAGI,SAAS,CAACC,OAAO;EAC7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