@vsaas/loopback-sdk-angular
v11.0.3
Published
Fork of LoopBack AngularJS SDK for generating AngularJS $resource clients from @vsaas LoopBack apps
Readme
LoopBack AngularJS SDK
@vsaas/loopback-sdk-angular is a maintained fork of
loopback-sdk-angular for the Xompass LoopBack 3 stack.
This fork keeps the familiar service generator API while aligning the package
with the rest of the modernized @vsaas/* monorepo:
- TypeScript source in
src/ - build output in
dist/ vitest,oxlint,oxfmt, andtsdown- scoped workspace dependencies on the local
@vsaas/*LoopBack forks - smaller dependency surface with no bundled AngularJS runtime in the package
This package is intended for maintaining AngularJS 1.x clients that consume LoopBack 3 style APIs generated from the Xompass forks. It is not targeted at LoopBack 4 or modern Angular.
Installation
npm install @vsaas/loopback-sdk-angularIn practice this package is typically used alongside:
@vsaas/loopback@vsaas/loopback-datasource-juggler- AngularJS
1.xwithngResourcein the client application
Usage
Generate AngularJS services for a LoopBack application:
const fs = require('node:fs');
const loopback = require('@vsaas/loopback');
const { services } = require('@vsaas/loopback-sdk-angular');
const app = loopback();
app.dataSource('db', { connector: 'memory' });
app.use('/api', loopback.rest());
const sdk = services(app, {
ngModuleName: 'lbServices',
apiUrl: '/api',
minify: true,
});
fs.writeFileSync('client/lb-services.js', sdk, 'utf8');The generated file defines an AngularJS module containing $resource services
for the shared LoopBack models and methods exposed by the application.
The legacy call signature is still supported for compatibility:
const sdk = services(app, 'lbServices', '/api');Scope
This package currently supports:
services(app, options)for generating AngularJS$resourceclients- the legacy
services(app, ngModuleName, apiUrl)signature - shared model methods and relation/scope helper generation
- optional schema emission via
includeSchema - generated common helpers such as
LoopBackAuthandLoopBackResource
The generated client code targets AngularJS 1.x and expects angular plus
ngResource to be available in the consuming application. This package only
generates the client source; it does not ship AngularJS itself.
Options
Supported generator options:
ngModuleNameDefault:"lbServices"apiUrlDefault:"/"includeCommonModulesDefault:trueincludeSchemaDefault:falseminifyDefault:falsenamespaceModelsDefault:falsenamespaceCommonModelsDefault:falsenamespaceDelimiterDefault:"."modelsToIgnoreDefault:[]commentsDefault:false
Notes for Fork Users
- This is a fork, not the upstream
loopback-sdk-angularpackage. - The package name is
@vsaas/loopback-sdk-angular. - Published runtime code is exposed from
dist/. - The package source has been migrated to TypeScript, but generated test files
remain plain
.js. - AngularJS is deprecated upstream; this fork is focused on pragmatic compatibility for existing legacy applications.
Development
npm run build
npm run typecheck
npm run lint
npm testLicense
MIT. See LICENSE.
