@ng-openapi/http-resource 0.2.0 → 0.2.1-pr-130-feat-npm-package-scaffold-1f8f1a6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -36,7 +36,7 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/lib/http-resource.generator.ts
39
- var import_ts_morph = require("ts-morph");
39
+ var import_ts_morph3 = require("ts-morph");
40
40
 
41
41
  // ../../shared/src/errors.ts
42
42
  var NG_OPENAPI_ERROR_BRAND = "__ngOpenApiError";
@@ -3584,7 +3584,11 @@ function joinRequestOptionEntries(entries) {
3584
3584
  }
3585
3585
  __name(joinRequestOptionEntries, "joinRequestOptionEntries");
3586
3586
 
3587
+ // ../../shared/src/emit/text-file.emit.ts
3588
+ var import_ts_morph = require("ts-morph");
3589
+
3587
3590
  // ../../shared/src/utils/project.utils.ts
3591
+ var import_ts_morph2 = require("ts-morph");
3588
3592
  function listGeneratedFileNames(project, directoryPath, suffix) {
3589
3593
  const directory = project.getDirectory(directoryPath);
3590
3594
  if (!directory) {
@@ -4162,20 +4166,20 @@ var HttpResourceGenerator = class {
4162
4166
  serviceClass.addProperty({
4163
4167
  name: "basePath",
4164
4168
  type: "string",
4165
- scope: import_ts_morph.Scope.Private,
4169
+ scope: import_ts_morph3.Scope.Private,
4166
4170
  isReadonly: true,
4167
4171
  initializer: `inject(${basePathTokenName})`
4168
4172
  });
4169
4173
  serviceClass.addProperty({
4170
4174
  name: "clientContextToken",
4171
4175
  type: "HttpContextToken<string>",
4172
- scope: import_ts_morph.Scope.Private,
4176
+ scope: import_ts_morph3.Scope.Private,
4173
4177
  isReadonly: true,
4174
4178
  initializer: clientContextTokenName
4175
4179
  });
4176
4180
  serviceClass.addMethod({
4177
4181
  name: "createContextWithClientId",
4178
- scope: import_ts_morph.Scope.Private,
4182
+ scope: import_ts_morph3.Scope.Private,
4179
4183
  parameters: [
4180
4184
  {
4181
4185
  name: "existingContext",
package/index.d.ts CHANGED
@@ -185,6 +185,12 @@ interface SpecVersion {
185
185
  type: "swagger" | "openapi";
186
186
  version: string;
187
187
  }
188
+ /** Descriptive metadata from the spec's `info` object, as authored. */
189
+ interface SpecInfo {
190
+ title?: string;
191
+ version?: string;
192
+ description?: string;
193
+ }
188
194
  /**
189
195
  * Version-free view of a parsed spec: Swagger 2.0 vs OpenAPI 3.x differences
190
196
  * are resolved once at normalization time. Generators consume this instead of
@@ -192,6 +198,8 @@ interface SpecVersion {
192
198
  */
193
199
  interface NormalizedSpec {
194
200
  version: SpecVersion | null;
201
+ /** The spec's `info` block; its `version` defaults a generated package's own version. */
202
+ info?: SpecInfo;
195
203
  /** 2.0 `definitions` or 3.x `components.schemas`, whichever the spec has */
196
204
  definitions: Record<string, SwaggerDefinition>;
197
205
  operations: NormalizedOperation[];
@@ -254,6 +262,48 @@ interface NamingOptions {
254
262
  resources?: NameDecoration;
255
263
  models?: NameDecoration;
256
264
  }
265
+ /**
266
+ * Turns the output directory into a standalone Angular library that builds
267
+ * with ng-packagr and publishes to npm. Every scaffold file is regenerated on
268
+ * each run, like the rest of the output — customize through this object, not
269
+ * by editing the emitted files.
270
+ */
271
+ interface PackageConfig {
272
+ /** npm package name written to package.json (`@scope/name` or `name`). */
273
+ name: string;
274
+ /** package.json `version`. Default: the spec's `info.version`, else "0.0.0". */
275
+ version?: string;
276
+ /** package.json `repository` (a URL, or the `{ type, url, directory? }` object form). */
277
+ repository?: string | {
278
+ type: string;
279
+ url: string;
280
+ directory?: string;
281
+ };
282
+ /** Written as `publishConfig.registry` — for publishing to a private registry. */
283
+ publishRegistry?: string;
284
+ /**
285
+ * Angular major the package targets, as a semver range such as "^20.0.0".
286
+ * Drives the `@angular/*` peer range and the ng-packagr toolchain versions
287
+ * in devDependencies. Default: the major of the `@angular/core` installed
288
+ * in the workspace the generator runs in, else the generator's own
289
+ * supported major (reported through a warning, since it is a guess).
290
+ */
291
+ angularVersion?: string;
292
+ /**
293
+ * Deep-merged onto the generated package.json — nested objects merge
294
+ * key by key, everything else is replaced, and your values win. `name`
295
+ * and `version` are not accepted here (set `package.name` /
296
+ * `package.version`). Dependency maps and `scripts` must be objects of
297
+ * strings, so a derived `peerDependencies` entry can have its range
298
+ * changed but not be removed; replacing the generated `scripts.build` or
299
+ * `dependencies.tslib` is honored with a warning, since either breaks the
300
+ * documented build.
301
+ */
302
+ packageJson?: Record<string, unknown> & {
303
+ name?: never;
304
+ version?: never;
305
+ };
306
+ }
257
307
  /**
258
308
  * The user-facing configuration (config file or programmatic call).
259
309
  * Validated at the boundary by validateGeneratorConfig, which throws
@@ -327,6 +377,8 @@ interface GeneratorConfig {
327
377
  };
328
378
  /** Plugin generator classes, run after core generation (see PluginGeneratorContext). */
329
379
  plugins?: IPluginGeneratorClass[];
380
+ /** Emit package.json & co. so the output builds and publishes as an npm package (see PackageConfig). */
381
+ package?: PackageConfig;
330
382
  }
331
383
 
332
384
  declare class HttpResourceGenerator implements IPluginGenerator {
package/index.js CHANGED
@@ -3550,7 +3550,11 @@ function joinRequestOptionEntries(entries) {
3550
3550
  }
3551
3551
  __name(joinRequestOptionEntries, "joinRequestOptionEntries");
3552
3552
 
3553
+ // ../../shared/src/emit/text-file.emit.ts
3554
+ import { ScriptKind } from "ts-morph";
3555
+
3553
3556
  // ../../shared/src/utils/project.utils.ts
3557
+ import { ScriptKind as ScriptKind2 } from "ts-morph";
3554
3558
  function listGeneratedFileNames(project, directoryPath, suffix) {
3555
3559
  const directory = project.getDirectory(directoryPath);
3556
3560
  if (!directory) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-openapi/http-resource",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-pr-130-feat-npm-package-scaffold-1f8f1a6.0",
4
4
  "description": "HTTP Resource plugin for ng-openapi - Angular HTTP utilities with caching and state management",
5
5
  "keywords": [
6
6
  "angular",