@osdk/generator 1.14.0-beta.0 → 1.14.0-beta.2

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 1.14.0-beta.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 68a8dc7: Fixes an issue that could cause an object with sub-selection to be assigned as a full object
8
+ - 081114f: Splits batchApplyAction out of applyAction
9
+
10
+ ## 1.14.0-beta.1
11
+
12
+ ### Minor Changes
13
+
14
+ - 51fe88c: Fix edge case with never in newly generated types
15
+
3
16
  ## 1.14.0-beta.0
4
17
 
5
18
  ### Minor Changes
@@ -71,7 +71,7 @@ var EnhancedAction = class extends EnhancedBase {
71
71
  return this.og.operations;
72
72
  }
73
73
  get paramsIdentifier() {
74
- return `${this.shortApiName}.Parameters`;
74
+ return `${this.shortApiName}.Params`;
75
75
  }
76
76
  get definitionIdentifier() {
77
77
  return `${this.shortApiName}.Definition`;
@@ -1940,7 +1940,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
1940
1940
 
1941
1941
 
1942
1942
 
1943
- /** @deprecated use ${object.shortApiName}.Definition **/
1943
+
1944
1944
  export type ${objectDefIdentifier} = ${object.shortApiName}.Definition;
1945
1945
 
1946
1946
 
@@ -1970,7 +1970,7 @@ function createOsdkObject(object, identifier, {
1970
1970
  const definition = object.getCleanedUpDefinition(true);
1971
1971
  return `
1972
1972
  export type ${identifier}<
1973
- OPTIONS extends "$strict" | "$notStrict" | "$rid" = "$strict",
1973
+ OPTIONS extends never | "$notStrict" | "$rid" = never,
1974
1974
  K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
1975
1975
 
1976
1976
  >
@@ -1978,6 +1978,8 @@ function createOsdkObject(object, identifier, {
1978
1978
  ${objectDefIdentifier},
1979
1979
  K | OPTIONS
1980
1980
  > & Pick<
1981
+ [OPTIONS] extends [never]
1982
+ ? ${osdkObjectStrictPropsIdentifier} :
1981
1983
  OPTIONS extends "$notStrict" ? ${osdkObjectPropsIdentifier} : ${osdkObjectStrictPropsIdentifier}
1982
1984
  , K
1983
1985
  > & {
@@ -2006,37 +2008,37 @@ $ObjectSet<${objectDefIdentifier},
2006
2008
  ${objectSetIdentifier}
2007
2009
  >
2008
2010
  {
2009
- readonly aggregate: <AO extends $AggregateOpts<${objectDefIdentifier}>>(
2011
+ readonly aggregate: <const AO extends $AggregateOpts<${objectDefIdentifier}>>(
2010
2012
  req: $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<${objectDefIdentifier}, AO>,
2011
2013
  ) => Promise<$AggregationsResults<${objectDefIdentifier}, AO>>;
2012
2014
 
2013
2015
 
2014
- readonly pivotTo: <L extends $LinkNames<${objectDefIdentifier}>>(type: L) => $LinkedType<${objectDefIdentifier}, L>["objectSet"];
2016
+ readonly pivotTo: <const L extends $LinkNames<${objectDefIdentifier}>>(type: L) => $LinkedType<${objectDefIdentifier}, L>["objectSet"];
2015
2017
  ${object instanceof EnhancedObjectType ? `
2016
2018
  readonly fetchOne: <
2017
- L extends ${propertyKeysIdentifier},
2018
- R extends boolean,
2019
- S extends false | "throw" = $NullabilityAdherenceDefault,
2019
+ const L extends ${propertyKeysIdentifier},
2020
+ const R extends boolean,
2021
+ const S extends false | "throw" = $NullabilityAdherenceDefault,
2020
2022
  >(
2021
2023
  primaryKey: $PropertyValueClientToWire[${objectDefIdentifier}["primaryKeyType"]],
2022
2024
  options?: $SelectArg<${objectDefIdentifier}, L, R, S>,
2023
2025
  ) => Promise<
2024
2026
  ${osdkObjectIdentifier}<
2025
- (S extends false ? "$notStrict" : "$strict") | ($DefaultToFalse<R> extends false? never: "$rid" ),
2027
+ (S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never: "$rid" ),
2026
2028
  L
2027
2029
  >>
2028
2030
  ;
2029
2031
 
2030
2032
  readonly fetchOneWithErrors: <
2031
- L extends ${propertyKeysIdentifier},
2032
- R extends boolean,
2033
- S extends false | "throw" = $NullabilityAdherenceDefault,
2033
+ const L extends ${propertyKeysIdentifier},
2034
+ const R extends boolean,
2035
+ const S extends false | "throw" = $NullabilityAdherenceDefault,
2034
2036
  >(
2035
2037
  primaryKey: $PropertyValueClientToWire[${objectDefIdentifier}["primaryKeyType"]],
2036
2038
  options?: $SelectArg<${objectDefIdentifier}, L, R, S>,
2037
2039
  ) => Promise<$Result<
2038
2040
  ${osdkObjectIdentifier}<
2039
- (S extends false ? "$notStrict" : "$strict") | ($DefaultToFalse<R> extends false?never: "$rid"),
2041
+ (S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false?never: "$rid"),
2040
2042
  L
2041
2043
  >
2042
2044
  >>
@@ -2046,29 +2048,29 @@ readonly fetchOneWithErrors: <
2046
2048
  ` : ""}
2047
2049
 
2048
2050
  readonly fetchPage: <
2049
- L extends ${propertyKeysIdentifier},
2050
- R extends boolean,
2051
- const A extends $Augments,
2052
- S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
2051
+ const L extends ${propertyKeysIdentifier},
2052
+ const R extends boolean,
2053
+ const const A extends $Augments,
2054
+ const S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
2053
2055
  >(
2054
2056
  args?: $FetchPageArgs<${objectDefIdentifier}, L, R, A, S>,
2055
2057
  ) => Promise<
2056
2058
  $PageResult<${osdkObjectIdentifier}<
2057
- (S extends false ? "$notStrict" : "$strict") | ($DefaultToFalse<R> extends false? never: "$rid"),
2059
+ (S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never: "$rid"),
2058
2060
  L
2059
2061
  >>
2060
2062
  >;
2061
2063
 
2062
2064
  readonly fetchPageWithErrors: <
2063
- L extends ${propertyKeysIdentifier},
2064
- R extends boolean,
2065
+ const L extends ${propertyKeysIdentifier},
2066
+ const R extends boolean,
2065
2067
  const A extends $Augments,
2066
- S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
2068
+ const S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
2067
2069
  >(
2068
2070
  args?: $FetchPageArgs<${objectDefIdentifier}, L, R, A, S>,
2069
2071
  ) => Promise<$Result<
2070
2072
  $PageResult<${osdkObjectIdentifier}<
2071
- (S extends false ? "$notStrict" : "$strict") | ($DefaultToFalse<R> extends false? never : "$rid"),
2073
+ (S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never : "$rid"),
2072
2074
  L>>
2073
2075
  >>;
2074
2076
 
@@ -2189,9 +2191,9 @@ async function generatePerActionDataFiles({
2189
2191
  return JSON.stringify(type);
2190
2192
  } else if (type.type === "object") {
2191
2193
  const obj = enhancedOntology.requireObjectType(type.object);
2192
- return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}>`;
2194
+ return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}.Definition>`;
2193
2195
  } else if (type.type === "objectSet") {
2194
- return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}>`;
2196
+ return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}.Definition>`;
2195
2197
  }
2196
2198
  return void 0;
2197
2199
  }
@@ -2204,9 +2206,9 @@ async function generatePerActionDataFiles({
2204
2206
  if (typeof input === "string") {
2205
2207
  return `ActionParam.PrimitiveType<${JSON.stringify(input)}>`;
2206
2208
  } else if (input.type === "object") {
2207
- return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
2209
+ return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}.Definition>`;
2208
2210
  } else if (input.type === "objectSet") {
2209
- return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
2211
+ return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}.Definition>`;
2210
2212
  }
2211
2213
  }
2212
2214
  function createV2Types() {
@@ -2217,7 +2219,7 @@ async function generatePerActionDataFiles({
2217
2219
  ${createParamsDef()}
2218
2220
 
2219
2221
  ${getDescriptionIfPresent(action.description)}
2220
- export interface Parameters {
2222
+ export interface Params {
2221
2223
  ${stringify(parameters, {
2222
2224
  "*": (ogValue, _, ogKey) => {
2223
2225
  const key = `${getDescriptionIfPresent(ogValue.description)}
@@ -2227,10 +2229,12 @@ async function generatePerActionDataFiles({
2227
2229
  }
2228
2230
  })}
2229
2231
  }
2232
+ /** @deprecated **/
2233
+ export type Parameters = Params;
2230
2234
 
2231
2235
 
2232
2236
  // Represents the definition of the action
2233
- export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}>, VersionBound<$ExpectedClientVersion> {
2237
+ export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
2234
2238
  ${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
2235
2239
  return `${key}: ${JSON.stringify(value)};`;
2236
2240
  }).join("\n")}
@@ -2239,9 +2243,11 @@ async function generatePerActionDataFiles({
2239
2243
  }
2240
2244
 
2241
2245
  // Represents a fqn of the action
2242
- export interface Signature {
2246
+ export interface Signatures {
2243
2247
  ${getDescriptionIfPresent(action.description)}
2244
- <P extends ${action.paramsIdentifier} | ReadonlyArray<${action.paramsIdentifier}>, OP extends (P extends ReadonlyArray<${action.paramsIdentifier}> ? ApplyBatchActionOptions: ApplyActionOptions)>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
2248
+ applyAction<P extends ${action.paramsIdentifier}, OP extends ApplyActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
2249
+
2250
+ batchApplyAction<P extends ReadonlyArray<${action.paramsIdentifier}>, OP extends ApplyBatchActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
2245
2251
  }
2246
2252
 
2247
2253
  }
@@ -2252,7 +2258,7 @@ async function generatePerActionDataFiles({
2252
2258
  export type ${oldParamsIdentifier} = ${action.paramsIdentifier} | ReadonlyArray<${action.paramsIdentifier}>;
2253
2259
 
2254
2260
  /** @deprecated Use \`${action.definitionIdentifier}\` **/
2255
- export type ${action.shortApiName} = ${action.shortApiName}.Signature;
2261
+ export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
2256
2262
  `;
2257
2263
  }
2258
2264
  function createV2Object() {