-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into launchpad-plugin
- Loading branch information
Showing
6 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env node | ||
/* eslint-disable no-console */ | ||
|
||
const [,,$1] = process.argv | ||
const { exec } = require('child_process') | ||
const path = require('path') | ||
const { readFile, writeFile } = require("fs").promises; | ||
const { join } = require("path"); | ||
|
||
async function remoteService () { | ||
const TARGET_DIR = "xmpls/remote-service" | ||
const levelUP = "../../" | ||
const INCLUDES = ["srv", "test"] | ||
const paths = INCLUDES.map(pattern => join(__dirname, levelUP, TARGET_DIR, pattern)) | ||
const cmd = `cp -r ${paths.join(' ')} ${join(__dirname, levelUP)}` | ||
await run(cmd); | ||
|
||
const packageJson = JSON.parse(await readFile(join(__dirname, levelUP ,"package.json"), "utf-8")); | ||
const delta = JSON.parse(await readFile(join(__dirname, levelUP, TARGET_DIR, "package.json"), "utf-8")); | ||
packageJson.cds.requires["API_BUSINESS_PARTNER"] = delta.cds.requires["API_BUSINESS_PARTNER"] | ||
await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8"); | ||
|
||
// dependencies | ||
const deps = [ | ||
"@sap-cloud-sdk/connectivity", | ||
"@sap-cloud-sdk/http-client", | ||
"@sap-cloud-sdk/resilience", | ||
"@sap-cloud-sdk/util" | ||
] | ||
return await run(`npm add ${deps.join(" ")}`) | ||
} | ||
|
||
async function messaging () { | ||
const TARGET_DIR = "xmpls/messaging" | ||
const levelUP = "../../" | ||
const INCLUDES = ["app", "srv", "test"] | ||
const paths = INCLUDES.map(pattern => join(__dirname, levelUP, TARGET_DIR, pattern)) | ||
const cmd = `cp -r ${paths.join(' ')} ${join(__dirname, levelUP)}` | ||
await run(cmd); | ||
|
||
const packageJson = JSON.parse(await readFile(join(__dirname, levelUP, "package.json"), "utf-8")); | ||
const delta = JSON.parse(await readFile(join(__dirname, levelUP, TARGET_DIR, "package.json"), "utf-8")); | ||
packageJson.cds.requires["API_BUSINESS_PARTNER"] = delta.cds.requires["API_BUSINESS_PARTNER"] | ||
packageJson.cds.requires["messaging"] = delta.cds.requires["messaging"] | ||
await writeFile(join(__dirname, levelUP, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8"); | ||
|
||
// dependencies | ||
const deps = [ | ||
"@sap-cloud-sdk/connectivity", | ||
"@sap-cloud-sdk/http-client", | ||
"@sap-cloud-sdk/resilience", | ||
"@sap-cloud-sdk/util", | ||
"@sap/xb-msg-amqp-v100" | ||
] | ||
return await run(`npm add ${deps.join(" ")}`) | ||
} | ||
|
||
function run (cmd, silent) { | ||
if (cmd.raw) return run (String.raw(...arguments)) | ||
if (cmd.endsWith('--silent')) silent = cmd = cmd.slice(0,-9) | ||
if (typeof cmd === 'string') cmd = new Promise ((done,failed) => { | ||
const cp = exec (cmd, (e,stdout) => e ? failed(e) : done(stdout)) | ||
if (!silent) { | ||
cp.stdout.on ('data', d => process.stdout.write(d)) | ||
cp.stderr.on ('data', d => process.stderr.write(d)) | ||
} | ||
}) | ||
return cmd | ||
} | ||
|
||
switch ($1) { | ||
|
||
case 'remote-service': | ||
remoteService(); | ||
break; | ||
case 'messaging': | ||
messaging(); | ||
break; | ||
default: | ||
console.log('Usage: ./checkout <command>'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,15 +25,15 @@ Authorization: Basic alice:wonderland | |
Content-Type: application/json | ||
|
||
{ | ||
"ID": "{{$guid}}", | ||
"ID": "{{$randomInt 9000000 9999999}}", | ||
"firstName": "Bob", | ||
"lastName": "Builder", | ||
"email": "[email protected]" | ||
} | ||
|
||
### Updating a customer with personal data details | ||
@customer = {{create_customer.response.body.ID}} | ||
PATCH {{host}}/odata/v4/admin/Customers({{customer}}) | ||
PATCH {{host}}/odata/v4/admin/Customers('{{customer}}') | ||
Authorization: Basic alice:wonderland | ||
Content-Type: application/json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
using from './incidents/field'; |
This file was deleted.
Oops, something went wrong.