@osdk/generator 2.1.0-beta.2 → 2.1.0-beta.20

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 (78) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/build/browser/GenerateContext/GenerateContext.d.ts +1 -0
  3. package/build/browser/GenerateContext/GenerateContext.d.ts.map +1 -1
  4. package/build/browser/generateClientSdkPackage.test.js +2 -2
  5. package/build/browser/generateClientSdkPackage.test.js.map +1 -1
  6. package/build/browser/util/test/TodoWireOntology.d.ts +5 -0
  7. package/build/browser/util/test/TodoWireOntology.d.ts.map +1 -1
  8. package/build/browser/util/test/TodoWireOntology.js +10 -5
  9. package/build/browser/util/test/TodoWireOntology.js.map +1 -1
  10. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +6 -6
  11. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  12. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +14 -20
  13. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  14. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  15. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  16. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
  17. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  18. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +74 -87
  19. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  20. package/build/browser/v2.0/generatePerActionDataFiles.d.ts +1 -1
  21. package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
  22. package/build/browser/v2.0/generatePerActionDataFiles.js +3 -2
  23. package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
  24. package/build/browser/v2.0/generatePerInterfaceDataFiles.js +4 -3
  25. package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
  26. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +1 -1
  27. package/build/browser/v2.0/generatePerObjectDataFiles.js +1 -1
  28. package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
  29. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts +1 -1
  30. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  31. package/build/browser/v2.0/generatePerQueryDataFiles.js +5 -5
  32. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  33. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +7 -8
  34. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  35. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  36. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +21 -10
  37. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  38. package/build/browser/validateWireOntologyAssumptions.js +2 -2
  39. package/build/browser/validateWireOntologyAssumptions.js.map +1 -1
  40. package/build/esm/GenerateContext/GenerateContext.d.ts +1 -0
  41. package/build/esm/GenerateContext/GenerateContext.d.ts.map +1 -1
  42. package/build/esm/generateClientSdkPackage.test.js +2 -2
  43. package/build/esm/generateClientSdkPackage.test.js.map +1 -1
  44. package/build/esm/util/test/TodoWireOntology.d.ts +5 -0
  45. package/build/esm/util/test/TodoWireOntology.d.ts.map +1 -1
  46. package/build/esm/util/test/TodoWireOntology.js +10 -5
  47. package/build/esm/util/test/TodoWireOntology.js.map +1 -1
  48. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +6 -6
  49. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  50. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +14 -20
  51. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  52. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  53. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  54. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
  55. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  56. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +74 -87
  57. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  58. package/build/esm/v2.0/generatePerActionDataFiles.d.ts +1 -1
  59. package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
  60. package/build/esm/v2.0/generatePerActionDataFiles.js +3 -2
  61. package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
  62. package/build/esm/v2.0/generatePerInterfaceDataFiles.js +4 -3
  63. package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
  64. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +1 -1
  65. package/build/esm/v2.0/generatePerObjectDataFiles.js +1 -1
  66. package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
  67. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +1 -1
  68. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  69. package/build/esm/v2.0/generatePerQueryDataFiles.js +5 -5
  70. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  71. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +7 -8
  72. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  73. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  74. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +21 -10
  75. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  76. package/build/esm/validateWireOntologyAssumptions.js +2 -2
  77. package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
  78. package/package.json +12 -9
@@ -22,7 +22,8 @@ import { deleteUndefineds } from "../util/deleteUndefineds.js";
22
22
  import { stringify } from "../util/stringify.js";
23
23
  /** @internal */
24
24
  export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
25
- ontology
25
+ ontology,
26
+ forInternalUse
26
27
  }, currentFilePath) {
27
28
  const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
28
29
  if (object instanceof ForeignType) {
@@ -48,19 +49,19 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
48
49
  propertyKeysIdentifier
49
50
  };
50
51
  const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
51
- return `${imports}${function (object) {
52
+ return `${imports}${function (object, forInternalUse = false) {
52
53
  return `import type {
53
54
  PropertyKeys as $PropertyKeys,
54
55
  ObjectTypeDefinition as $ObjectTypeDefinition,
55
56
  ObjectMetadata as $ObjectMetadata,
56
- } from "@osdk/api";
57
+ } from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
57
58
  import type {
58
59
  ObjectSet as $ObjectSet,
59
60
  Osdk as $Osdk,
60
61
  OsdkObject as $OsdkObject,
61
62
  PropertyValueWireToClient as $PropType,
62
63
  SingleLinkAccessor as $SingleLinkAccessor,
63
- } from "@osdk/api";
64
+ } from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
64
65
 
65
66
 
66
67
  export namespace ${object.shortApiName} {
@@ -82,7 +83,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
82
83
 
83
84
  ${createDefinition(object, ontology, object.shortApiName, identifiers)}
84
85
  `;
85
- }(object)}
86
+ }(object, forInternalUse)}
86
87
 
87
88
  export const ${object.shortApiName}: ${objectDefIdentifier}
88
89
  = {
@@ -100,7 +101,7 @@ export function createOsdkObject(object, identifier, {
100
101
  object.getCleanedUpDefinition(true);
101
102
  return `
102
103
  export type ${identifier}<
103
- OPTIONS extends never | "$notStrict" | "$rid" = never,
104
+ OPTIONS extends never | "$rid" = never,
104
105
  K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
105
106
  >
106
107
  = $Osdk.Instance<
@@ -112,7 +113,7 @@ export function createOsdkObject(object, identifier, {
112
113
 
113
114
  /** @deprecated use ${identifier} */
114
115
  export type OsdkObject<
115
- OPTIONS extends never | "$notStrict" | "$rid" = never,
116
+ OPTIONS extends never | "$rid" = never,
116
117
  K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
117
118
  > = ${identifier}<OPTIONS, K>;
118
119
  ;
@@ -143,6 +144,9 @@ function maybeStripNamespace(type, q) {
143
144
  }
144
145
  }
145
146
  export function createProps(type, identifier, strict) {
147
+ if (identifier === "StrictProps") {
148
+ return `export type StrictProps = Props`;
149
+ }
146
150
  const definition = type.getCleanedUpDefinition(true);
147
151
  return `export interface ${identifier} {
148
152
  ${stringify(definition.properties, {
@@ -150,7 +154,7 @@ ${stringify(definition.properties, {
150
154
  return [`readonly "${maybeStripNamespace(type, apiName)}"${
151
155
  // after we convert everything over we can do this:
152
156
  // !strict || propertyDefinition.nullable ? "?" : ""
153
- ""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict ? `| undefined` : ""}`];
157
+ ""}`, (typeof propertyDefinition.type === "object" ? `${remapStructType(propertyDefinition.type)}` : `$PropType[${JSON.stringify(propertyDefinition.type)}]`) + `${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict && !(definition.type === "object" && definition.primaryKeyApiName === apiName) ? `| undefined` : ""}`];
154
158
  }
155
159
  })}
156
160
  }`;
@@ -183,7 +187,7 @@ export function createDefinition(object, ontology, identifier, {
183
187
  ${stringify(definition.properties, {
184
188
  "*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
185
189
  apiName
186
- })}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
190
+ })}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
187
191
  })}
188
192
  }`
189
193
  })}
@@ -207,6 +211,13 @@ ${stringify(definition.links, {
207
211
  `}`;
208
212
  }
209
213
  export function createPropertyKeys(type) {
210
- return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
214
+ const properties = Object.keys(type.getCleanedUpDefinition(true).properties);
215
+ return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
216
+ }
217
+ function remapStructType(structType) {
218
+ let output = `{`;
219
+ Object.entries(structType).map(([key, value]) => output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`);
220
+ output += "}";
221
+ return output;
211
222
  }
212
223
  //# sourceMappingURL=wireObjectTypeV2ToSdkObjectConstV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","currentFilePath","object","requireObjectType","objectType","apiName","Error","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","JSON","multiplicity","nullable","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n if (object instanceof ForeignType) {\n throw new Error(\"Should not be generating types for an external type\");\n }\n const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));\n const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n const identifiers = {\n objectDefIdentifier: `${object.shortApiName}`,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types(object) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"@osdk/api\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"@osdk/api\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkInstance\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\n return `${imports}${getV2Types(object)}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > = ${identifier}<OPTIONS, K>;\n ;\n `;\n}\nexport function createObjectSet(object, { objectDefIdentifier, objectSetIdentifier, propertyKeysIdentifier, osdkObjectIdentifier, }) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\nfunction maybeStripNamespace(type, q) {\n if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {\n return q.slice(type.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n}\nexport function createProps(type, identifier, strict) {\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable || !strict ? `| undefined` : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`} {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectMetadata.Link<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<\"${propertyDefinition.type}\", \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,g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I,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC8C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC3K","ignoreList":[]}
1
+ {"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","forInternalUse","currentFilePath","object","requireObjectType","objectType","apiName","Error","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","remapStructType","JSON","multiplicity","nullable","primaryKeyApiName","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join","structType","output","entries","value"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology, forInternalUse }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n if (object instanceof ForeignType) {\n throw new Error(\"Should not be generating types for an external type\");\n }\n const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));\n const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n const identifiers = {\n objectDefIdentifier: `${object.shortApiName}`,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types(object, forInternalUse = false) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkInstance\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\n return `${imports}${getV2Types(object, forInternalUse)}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > = ${identifier}<OPTIONS, K>;\n ;\n `;\n}\nexport function createObjectSet(object, { objectDefIdentifier, objectSetIdentifier, propertyKeysIdentifier, osdkObjectIdentifier, }) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\nfunction maybeStripNamespace(type, q) {\n if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {\n return q.slice(type.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n}\nexport function createProps(type, identifier, strict) {\n if (identifier === \"StrictProps\") {\n return `export type StrictProps = Props`;\n }\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n (typeof propertyDefinition.type === \"object\"\n ? `${remapStructType(propertyDefinition.type)}`\n : `$PropType[${JSON.stringify(propertyDefinition.type)}]`)\n + `${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable\n || (!strict\n && !(definition.type === \"object\"\n && definition.primaryKeyApiName === apiName))\n ? `| undefined`\n : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`} {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectMetadata.Link<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n const properties = Object.keys(type.getCleanedUpDefinition(true).properties);\n return `export type PropertyKeys = ${properties.length === 0\n ? \"never\"\n : properties.map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\nfunction remapStructType(structType) {\n let output = `{`;\n Object.entries(structType).map(([key, value]) => output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`);\n output += \"}\";\n return output;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD;AACA,OAAO,SAASC,kCAAkCA,CAACC,UAAU,EAAE;EAAEC,QAAQ;EAAEC;AAAe,CAAC,EAAEC,eAAe,EAAE;EAC1G,MAAMC,MAAM,GAAGH,QAAQ,C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AkBA,CAACU,IAAI,EAAE;EACrC,MAAMO,UAAU,GAAGY,MAAM,CAACC,IAAI,CAACpB,IAAI,CAACF,sBAAsB,CAAC,IAAI,CAAC,CAACS,UAAU,CAAC;EAC5E,OAAO,8BAA8BA,UAAU,CAACF,MAAM,KAAK,CAAC,GACtD,OAAO,GACPE,UAAU,CAACjC,GAAG,CAAEC,CAAC,IAAKwB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAACgD,IAAI,CAAC,GAAG,CAAC,GAAG;AAC7F;AACA,SAASZ,eAAeA,CAACa,UAAU,EAAE;EACjC,IAAIC,MAAM,GAAG,GAAG;EAChBN,MAAM,CAACO,OAAO,CAACF,UAAU,CAAC,CAAClD,GAAG,CAAC,CAAC,CAAC+C,GAAG,EAAEM,KAAK,CAAC,KAAKF,MAAM,IAAI,GAAGJ,GAAG,cAAcT,IAAI,CAACpD,SAAS,CAACmE,KAAK,CAAC,cAAc,CAAC;EACnHF,MAAM,IAAI,GAAG;EACb,OAAOA,MAAM;AACjB","ignoreList":[]}
@@ -25,9 +25,9 @@ export function validateWireOntologyAssumptions(ontology) {
25
25
  }
26
26
  }
27
27
  function invariantMapKeyMatchesApiName(key, value) {
28
- !(key === value.apiName) ? invariant(false, "Key in the map should be the same as the apiName.") : void 0;
28
+ !(key === value.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, "Key in the map should be the same as the apiName.") : invariant(false) : void 0;
29
29
  }
30
30
  function invariantNotStartWithDollarSign(value) {
31
- !!value.startsWith("$") ? invariant(false, "apiName should not start with $") : void 0;
31
+ !!value.startsWith("$") ? process.env.NODE_ENV !== "production" ? invariant(false, "apiName should not start with $") : invariant(false) : void 0;
32
32
  }
33
33
  //# sourceMappingURL=validateWireOntologyAssumptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","startsWith"],"sources":["validateWireOntologyAssumptions.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport invariant from \"tiny-invariant\";\nexport function validateWireOntologyAssumptions(ontology) {\n invariantNotStartWithDollarSign(ontology.ontology.apiName);\n for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {\n invariantMapKeyMatchesApiName(objectKey, objectType.objectType);\n invariantNotStartWithDollarSign(objectType.objectType.apiName);\n for (const [propertyKey, propertyType] of Object.entries(objectType.objectType.properties)) {\n invariantNotStartWithDollarSign(propertyKey);\n }\n }\n}\nfunction invariantMapKeyMatchesApiName(key, value) {\n invariant(key === value.apiName, \"Key in the map should be the same as the apiName.\");\n}\nfunction invariantNotStartWithDollarSign(value) {\n invariant(!value.startsWith(\"$\"), \"apiName should not start with $\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,+BAA+BA,CAACC,QAAQ,EAAE;EACtDC,+BAA+B,CAACD,QAAQ,CAACA,QAAQ,CAACE,OAAO,CAAC;EAC1D,KAAK,MAAM,CAACC,SAAS,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IACxEC,6BAA6B,CAACL,SAAS,EAAEC,UAAU,CAACA,UAAU,CAAC;IAC/DH,+BAA+B,CAACG,UAAU,CAACA,UAAU,CAACF,OAAO,CAAC;IAC9D,KAAK,MAAM,CAACO,WAAW,EAAEC,YAAY,CAAC,IAAIL,MAAM,CAACC,OAAO,CAACF,UAAU,CAACA,UAAU,CAACO,UAAU,CAAC,EAAE;MACxFV,+BAA+B,CAACQ,WAAW,CAAC;IAChD;EACJ;AACJ;AACA,SAASD,6BAA6BA,CAACI,GAAG,EAAEC,KAAK,EAAE;EAC/C,EAAUD,GAAG,KAAKC,KAAK,CAACX,OAAO,IAA/BJ,SAAS,QAAwB,mDAAmD;AACxF;AACA,SAASG,+BAA+BA,CAACY,KAAK,EAAE;EAC5C,CAAU,CAACA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,GAAhChB,SAAS,QAAyB,iCAAiC;AACvE","ignoreList":[]}
1
+ {"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","process","env","NODE_ENV","startsWith"],"sources":["validateWireOntologyAssumptions.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport invariant from \"tiny-invariant\";\nexport function validateWireOntologyAssumptions(ontology) {\n invariantNotStartWithDollarSign(ontology.ontology.apiName);\n for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {\n invariantMapKeyMatchesApiName(objectKey, objectType.objectType);\n invariantNotStartWithDollarSign(objectType.objectType.apiName);\n for (const [propertyKey, propertyType] of Object.entries(objectType.objectType.properties)) {\n invariantNotStartWithDollarSign(propertyKey);\n }\n }\n}\nfunction invariantMapKeyMatchesApiName(key, value) {\n invariant(key === value.apiName, \"Key in the map should be the same as the apiName.\");\n}\nfunction invariantNotStartWithDollarSign(value) {\n invariant(!value.startsWith(\"$\"), \"apiName should not start with $\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,+BAA+BA,CAACC,QAAQ,EAAE;EACtDC,+BAA+B,CAACD,QAAQ,CAACA,QAAQ,CAACE,OAAO,CAAC;EAC1D,KAAK,MAAM,CAACC,SAAS,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IACxEC,6BAA6B,CAACL,SAAS,EAAEC,UAAU,CAACA,UAAU,CAAC;IAC/DH,+BAA+B,CAACG,UAAU,CAACA,UAAU,CAACF,OAAO,CAAC;IAC9D,KAAK,MAAM,CAACO,WAAW,EAAEC,YAAY,CAAC,IAAIL,MAAM,CAACC,OAAO,CAACF,UAAU,CAACA,UAAU,CAACO,UAAU,CAAC,EAAE;MACxFV,+BAA+B,CAACQ,WAAW,CAAC;IAChD;EACJ;AACJ;AACA,SAASD,6BAA6BA,CAACI,GAAG,EAAEC,KAAK,EAAE;EAC/C,EAAUD,GAAG,KAAKC,KAAK,CAACX,OAAO,IAAAY,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAA/BlB,SAAS,QAAwB,mDAAmD,IAApFA,SAAS;AACb;AACA,SAASG,+BAA+BA,CAACY,KAAK,EAAE;EAC5C,CAAU,CAACA,KAAK,CAACI,UAAU,CAAC,GAAG,CAAC,GAAAH,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAhClB,SAAS,QAAyB,iCAAiC,IAAnEA,SAAS;AACb","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/generator",
3
- "version": "2.1.0-beta.2",
3
+ "version": "2.1.0-beta.20",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -11,31 +11,34 @@
11
11
  "exports": {
12
12
  ".": {
13
13
  "browser": "./build/browser/index.js",
14
- "import": "./build/esm/index.js"
14
+ "import": "./build/esm/index.js",
15
+ "default": "./build/browser/index.js"
15
16
  },
16
17
  "./*": {
17
18
  "browser": "./build/browser/public/*.js",
18
- "import": "./build/esm/public/*.js"
19
+ "import": "./build/esm/public/*.js",
20
+ "default": "./build/browser/public/*.js"
19
21
  }
20
22
  },
21
23
  "dependencies": {
22
- "@osdk/internal.foundry.core": "0.3.0-beta.0",
24
+ "@osdk/internal.foundry.core": "2.8.0",
23
25
  "fast-deep-equal": "^3.1.3",
24
26
  "fetch-retry": "^6.0.0",
25
27
  "prettier": "^3.0.3",
26
28
  "tiny-invariant": "^1.3.1",
27
- "@osdk/api": "~2.1.0-beta.2",
28
- "@osdk/generator-converters": "~2.1.0-beta.2"
29
+ "@osdk/api": "~2.1.0-beta.20",
30
+ "@osdk/generator-converters": "~2.1.0-beta.20"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@types/node": "^18.0.0",
34
+ "consola": "^3.2.3",
32
35
  "immer": "^10.1.1",
33
36
  "ts-expect": "^1.3.0",
34
- "typescript": "^5.5.4",
37
+ "typescript": "~5.5.4",
35
38
  "vitest": "^2.1.2",
36
39
  "@osdk/monorepo.api-extractor": "~0.0.0",
37
- "@osdk/monorepo.tsconfig": "~0.0.0",
38
- "@osdk/monorepo.tsup": "~0.0.0"
40
+ "@osdk/monorepo.tsup": "~0.0.0",
41
+ "@osdk/monorepo.tsconfig": "~0.0.0"
39
42
  },
40
43
  "publishConfig": {
41
44
  "access": "public"