Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@retter/rio-generator

Package Overview
Dependencies
Maintainers
5
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@retter/rio-generator - npm Package Compare versions

Comparing version 1.2.12 to 1.3.0

6

.test.js

@@ -98,2 +98,8 @@ const generator = require('./dist/index').generator

},
Addresses: {
type: 'array',
items: {
$ref: '#/$defs/Address',
},
},
AttributeInput: {

@@ -100,0 +106,0 @@ type: 'object',

8

dist/index.js

@@ -59,3 +59,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var classes, models, lines, interfaces;
var classes, models, lines, arrayModels, interfaces;
return __generator(this, function (_a) {

@@ -68,2 +68,4 @@ switch (_a.label) {

lines = (_a.sent()).lines;
arrayModels = Object.keys(models).filter(function (m) { return models[m].type === 'array' && models[m].items.$ref; })
.map(function (m) { return "export interface " + m + " extends Array<" + models[m].items.$ref.split('/').pop() + ">{}"; }).join('\n');
interfaces = lines.join('\n');

@@ -76,6 +78,6 @@ switch (language) {

case 'typescript-client':
return [2 /*return*/, typescript_2.renderTypescript(classes, interfaces)];
return [2 /*return*/, typescript_2.renderTypescript(classes, interfaces, arrayModels)];
case 'typescript':
default:
return [2 /*return*/, typescript_1.renderTypescript(classes, interfaces)];
return [2 /*return*/, typescript_1.renderTypescript(classes, interfaces, arrayModels)];
}

@@ -82,0 +84,0 @@ return [2 /*return*/];

import { Classes } from '../../utils';
export declare function renderClass(classId: string, template: any): string;
export declare function renderTypescript(classes: Classes, interfaces: string): string;
export declare function renderTypescript(classes: Classes, interfaces: string, arrayModels: string): string;

@@ -22,5 +22,5 @@ "use strict";

exports.renderClass = renderClass;
function renderTypescript(classes, interfaces) {
function renderTypescript(classes, interfaces, arrayModels) {
var blocks = Object.keys(classes).map(function (classId) { return renderClass(classId, classes[classId]); });
return "\n// This is an auto generated file!\n\nimport Retter, { RetterCloudObject, RetterCloudObjectCall, RetterCloudObjectConfig } from '@retter/sdk'\n\n" + interfaces.trim() + "\n\nexport namespace RioClasses {\n " + blocks.reduce(function (f, i) {
return "\n// This is an auto generated file!\n\nimport Retter, { RetterCloudObject, RetterCloudObjectCall, RetterCloudObjectConfig } from '@retter/sdk'\n\n" + interfaces.trim() + "\n\n" + arrayModels.trim() + "\n\nexport namespace RioClasses {\n " + blocks.reduce(function (f, i) {
f = f + '\n\n' + i;

@@ -27,0 +27,0 @@ return f.trim();

import { Classes } from '../../utils';
export declare function renderClass(classId: string, template: any): string;
export declare function renderTypescript(classes: Classes, interfaces: string): string;
export declare function renderTypescript(classes: Classes, interfaces: string, arrayModels: string): string;

@@ -27,5 +27,5 @@ "use strict";

exports.renderClass = renderClass;
function renderTypescript(classes, interfaces) {
function renderTypescript(classes, interfaces, arrayModels) {
var blocks = Object.keys(classes).map(function (classId) { return renderClass(classId, classes[classId]); });
return "\n// This is an auto generated file!\n\nimport RDK, { KeyValueString, GetInstance, CloudObjectResponse } from '@retter/rdk'\n\ninterface RetterRequest<T> extends Omit<GetInstance, 'classId'|'body'> {\n body?: T\n}\n\ninterface RetterResponse<T> extends CloudObjectResponse {\n body?: T\n}\n\n" + interfaces.trim() + "\n\nexport interface RDKOptions<T = KeyValueString> {\n httpMethod?: string\n queryStringParams?: T\n headers?: KeyValueString\n}\n\nexport namespace Classes {\n " + blocks.reduce(function (f, i) {
return "\n// This is an auto generated file!\n\nimport RDK, { KeyValueString, GetInstance, CloudObjectResponse } from '@retter/rdk'\n\ninterface RetterRequest<T> extends Omit<GetInstance, 'classId'|'body'> {\n body?: T\n}\n\ninterface RetterResponse<T> extends CloudObjectResponse {\n body?: T\n}\n\n" + interfaces.trim() + "\n\n" + arrayModels.trim() + "\n\nexport interface RDKOptions<T = KeyValueString> {\n httpMethod?: string\n queryStringParams?: T\n headers?: KeyValueString\n}\n\nexport namespace Classes {\n " + blocks.reduce(function (f, i) {
f = f + '\n\n' + i;

@@ -32,0 +32,0 @@ return f.trim();

{
"name": "@retter/rio-generator",
"version": "1.2.12",
"version": "1.3.0",
"description": "retter io proxy class helper generator",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -10,2 +10,4 @@ import { Classes, Models, quickTypeJSONSchema, SupportedProgrammingLanguage } from './utils'

const { lines } = await quickTypeJSONSchema('RioModels', JSON.stringify({ properties: { ...models }, $defs: { ...models } }), language)
const arrayModels = Object.keys(models).filter((m: string) => models[m].type === 'array' && models[m].items.$ref)
.map((m: string) => `export interface ${m} extends Array<${models[m].items.$ref.split('/').pop()!}>{}`).join('\n')
const interfaces = lines.join('\n')

@@ -18,7 +20,7 @@ switch (language) {

case 'typescript-client':
return renderTypescriptClient(classes, interfaces)
return renderTypescriptClient(classes, interfaces, arrayModels)
case 'typescript':
default:
return renderTypescript(classes, interfaces)
return renderTypescript(classes, interfaces, arrayModels)
}
}

@@ -36,3 +36,3 @@ import YAML from 'yaml'

export function renderTypescript(classes: Classes, interfaces: string) {
export function renderTypescript(classes: Classes, interfaces: string, arrayModels: string) {
const blocks: any[] = Object.keys(classes).map((classId) => renderClass(classId, classes[classId]))

@@ -46,2 +46,4 @@ return `

${arrayModels.trim()}
export namespace RioClasses {

@@ -48,0 +50,0 @@ ${blocks.reduce((f, i) => {

@@ -97,3 +97,3 @@ import YAML from 'yaml'

export function renderTypescript(classes: Classes, interfaces: string) {
export function renderTypescript(classes: Classes, interfaces: string, arrayModels: string) {
const blocks: any[] = Object.keys(classes).map((classId) => renderClass(classId, classes[classId]))

@@ -115,2 +115,4 @@ return `

${arrayModels.trim()}
export interface RDKOptions<T = KeyValueString> {

@@ -117,0 +119,0 @@ httpMethod?: string

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc