Conexio amb la api

This commit is contained in:
janmaroto 2022-02-09 18:30:03 +01:00
commit b12369cb47
48513 changed files with 7391639 additions and 7 deletions

View file

@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';<% if (lazyRoute) { %>
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';<% } %>
const routes: Routes = [<% if (lazyRoute) { %>{ path: '', component: <%= classify(name) %>Component }<% } %>];
@NgModule({
imports: [RouterModule.for<%= routingScope %>(routes)],
exports: [RouterModule]
})
export class <%= classify(name) %>RoutingModule { }

View file

@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';<% if (commonModule) { %>
import { CommonModule } from '@angular/common';<% } %><% if (lazyRouteWithoutRouteModule) { %>
import { Routes, RouterModule } from '@angular/router';<% } %>
<% if (routing || lazyRouteWithRouteModule) { %>
import { <%= classify(name) %>RoutingModule } from './<%= dasherize(name) %>-routing.module';<% } %>
<% if (lazyRouteWithoutRouteModule) { %>
const routes: Routes = [
{ path: '', component: <%= classify(name) %>Component }
];<% } %>
@NgModule({
declarations: [],
imports: [<% if (commonModule) { %>
CommonModule<% } %><% if (routing || lazyRouteWithRouteModule) { %>,
<%= classify(name) %>RoutingModule<% } %><% if (lazyRouteWithoutRouteModule) { %>,
RouterModule.forChild(routes)<% } %>
]
})
export class <%= classify(name) %>Module { }

10
node_modules/@schematics/angular/module/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,10 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Rule } from '@angular-devkit/schematics';
import { Schema as ModuleOptions } from './schema';
export default function (options: ModuleOptions): Rule;

158
node_modules/@schematics/angular/module/index.js generated vendored Executable file
View file

@ -0,0 +1,158 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@angular-devkit/core");
const schematics_1 = require("@angular-devkit/schematics");
const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
const ast_utils_1 = require("../utility/ast-utils");
const change_1 = require("../utility/change");
const find_module_1 = require("../utility/find-module");
const lint_fix_1 = require("../utility/lint-fix");
const parse_name_1 = require("../utility/parse-name");
const workspace_1 = require("../utility/workspace");
const schema_1 = require("./schema");
function buildRelativeModulePath(options, modulePath) {
const importModulePath = core_1.normalize(`/${options.path}/` +
(options.flat ? '' : core_1.strings.dasherize(options.name) + '/') +
core_1.strings.dasherize(options.name) +
'.module');
return find_module_1.buildRelativePath(modulePath, importModulePath);
}
function addDeclarationToNgModule(options) {
return (host) => {
if (!options.module) {
return host;
}
const modulePath = options.module;
const text = host.read(modulePath);
if (text === null) {
throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`);
}
const sourceText = text.toString();
const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
const relativePath = buildRelativeModulePath(options, modulePath);
const changes = ast_utils_1.addImportToModule(source, modulePath, core_1.strings.classify(`${options.name}Module`), relativePath);
const recorder = host.beginUpdate(modulePath);
for (const change of changes) {
if (change instanceof change_1.InsertChange) {
recorder.insertLeft(change.pos, change.toAdd);
}
}
host.commitUpdate(recorder);
return host;
};
}
function addRouteDeclarationToNgModule(options, routingModulePath) {
return (host) => {
if (!options.route) {
return host;
}
if (!options.module) {
throw new Error('Module option required when creating a lazy loaded routing module.');
}
let path;
if (routingModulePath) {
path = routingModulePath;
}
else {
path = options.module;
}
const text = host.read(path);
if (!text) {
throw new Error(`Couldn't find the module nor its routing module.`);
}
const sourceText = text.toString();
const addDeclaration = ast_utils_1.addRouteDeclarationToModule(ts.createSourceFile(path, sourceText, ts.ScriptTarget.Latest, true), path, buildRoute(options, options.module));
const recorder = host.beginUpdate(path);
recorder.insertLeft(addDeclaration.pos, addDeclaration.toAdd);
host.commitUpdate(recorder);
return host;
};
}
function getRoutingModulePath(host, modulePath) {
const routingModulePath = modulePath.endsWith(find_module_1.ROUTING_MODULE_EXT)
? modulePath
: modulePath.replace(find_module_1.MODULE_EXT, find_module_1.ROUTING_MODULE_EXT);
return host.exists(routingModulePath) ? core_1.normalize(routingModulePath) : undefined;
}
function buildRoute(options, modulePath) {
const relativeModulePath = buildRelativeModulePath(options, modulePath);
const moduleName = `${core_1.strings.classify(options.name)}Module`;
const loadChildren = `() => import('${relativeModulePath}').then(m => m.${moduleName})`;
return `{ path: '${options.route}', loadChildren: ${loadChildren} }`;
}
function default_1(options) {
return async (host) => {
if (options.path === undefined) {
options.path = await workspace_1.createDefaultPath(host, options.project);
}
if (options.module) {
options.module = find_module_1.findModuleFromOptions(host, options);
}
let routingModulePath;
const isLazyLoadedModuleGen = !!(options.route && options.module);
if (isLazyLoadedModuleGen) {
options.routingScope = schema_1.RoutingScope.Child;
routingModulePath = getRoutingModulePath(host, options.module);
}
const parsedPath = parse_name_1.parseName(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
options.routing || (isLazyLoadedModuleGen && routingModulePath)
? schematics_1.noop()
: schematics_1.filter((path) => !path.endsWith('-routing.module.ts.template')),
schematics_1.applyTemplates({
...core_1.strings,
'if-flat': (s) => (options.flat ? '' : s),
lazyRoute: isLazyLoadedModuleGen,
lazyRouteWithoutRouteModule: isLazyLoadedModuleGen && !routingModulePath,
lazyRouteWithRouteModule: isLazyLoadedModuleGen && !!routingModulePath,
...options,
}),
schematics_1.move(parsedPath.path),
]);
const moduleDasherized = core_1.strings.dasherize(options.name);
const modulePath = `${!options.flat ? moduleDasherized + '/' : ''}${moduleDasherized}.module.ts`;
const componentOptions = {
module: modulePath,
flat: options.flat,
name: options.name,
path: options.path,
project: options.project,
};
return schematics_1.chain([
!isLazyLoadedModuleGen ? addDeclarationToNgModule(options) : schematics_1.noop(),
addRouteDeclarationToNgModule(options, routingModulePath),
schematics_1.mergeWith(templateSource),
isLazyLoadedModuleGen ? schematics_1.schematic('component', componentOptions) : schematics_1.noop(),
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
]);
};
}
exports.default = default_1;

55
node_modules/@schematics/angular/module/schema.d.ts generated vendored Executable file
View file

@ -0,0 +1,55 @@
/**
* Creates a new, generic NgModule definition in the given or default project.
*/
export interface Schema {
/**
* The new NgModule imports "CommonModule".
*/
commonModule?: boolean;
/**
* Create the new files at the top level of the current project root.
*/
flat?: boolean;
/**
* Apply lint fixes after generating the module.
* @deprecated Use "ng lint --fix" directly instead.
*/
lintFix?: boolean;
/**
* The declaring NgModule.
*/
module?: string;
/**
* The name of the NgModule.
*/
name: string;
/**
* The path at which to create the NgModule, relative to the workspace root.
*/
path?: string;
/**
* The name of the project.
*/
project?: string;
/**
* The route path for a lazy-loaded module. When supplied, creates a component in the new
* module, and adds the route to that component in the `Routes` array declared in the module
* provided in the `--module` option.
*/
route?: string;
/**
* Create a routing module.
*/
routing?: boolean;
/**
* The scope for the new routing module.
*/
routingScope?: RoutingScope;
}
/**
* The scope for the new routing module.
*/
export declare enum RoutingScope {
Child = "Child",
Root = "Root"
}

13
node_modules/@schematics/angular/module/schema.js generated vendored Executable file
View file

@ -0,0 +1,13 @@
"use strict";
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoutingScope = void 0;
/**
* The scope for the new routing module.
*/
var RoutingScope;
(function (RoutingScope) {
RoutingScope["Child"] = "Child";
RoutingScope["Root"] = "Root";
})(RoutingScope = exports.RoutingScope || (exports.RoutingScope = {}));

71
node_modules/@schematics/angular/module/schema.json generated vendored Executable file
View file

@ -0,0 +1,71 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "SchematicsAngularModule",
"title": "Angular Module Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new, generic NgModule definition in the given or default project.",
"properties": {
"name": {
"type": "string",
"description": "The name of the NgModule.",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "What name would you like to use for the NgModule?"
},
"path": {
"type": "string",
"format": "path",
"description": "The path at which to create the NgModule, relative to the workspace root.",
"visible": false
},
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
},
"routing": {
"type": "boolean",
"description": "Create a routing module.",
"default": false,
"x-user-analytics": 17
},
"routingScope": {
"enum": ["Child", "Root"],
"type": "string",
"description": "The scope for the new routing module.",
"default": "Child"
},
"route": {
"type": "string",
"description": "The route path for a lazy-loaded module. When supplied, creates a component in the new module, and adds the route to that component in the `Routes` array declared in the module provided in the `--module` option."
},
"flat": {
"type": "boolean",
"description": "Create the new files at the top level of the current project root. ",
"default": false
},
"commonModule": {
"type": "boolean",
"description": "The new NgModule imports \"CommonModule\". ",
"default": true,
"visible": false
},
"module": {
"type": "string",
"description": "The declaring NgModule.",
"alias": "m"
},
"lintFix": {
"type": "boolean",
"description": "Apply lint fixes after generating the module.",
"x-user-analytics": 15,
"x-deprecated": "Use \"ng lint --fix\" directly instead."
}
},
"required": ["name"]
}