Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: JavaScript namespaces, JSON-Schema Bundles, Bi-directional JSON-RPC changes #179

Open
wants to merge 66 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c9896f7
Push new workflow
kschrief Feb 23, 2024
0372e6e
Remove scary github actions
kschrief Feb 23, 2024
82f409f
Update
kschrief Feb 23, 2024
fa37994
Trigger
kschrief Feb 23, 2024
b1fe3bd
Trigger
kschrief Feb 23, 2024
f5ac990
Trigger
kschrief Feb 23, 2024
806e737
Introduce conflict
kschrief Feb 23, 2024
b423f5c
Yes. Good.
kschrief Feb 23, 2024
2aa497c
Get version number
kschrief Feb 27, 2024
337d36e
Get version number
kschrief Feb 27, 2024
90895c6
Get version number
kschrief Feb 27, 2024
d829527
Commit version change
kschrief Feb 27, 2024
3cdbd3c
Commit version change
kschrief Feb 27, 2024
814e1b5
Commit version change
kschrief Feb 27, 2024
37a11a0
Exit 0
kschrief Feb 27, 2024
a6bd102
Versions
kschrief Feb 27, 2024
70025d4
Versions
kschrief Feb 27, 2024
39fe788
Versions
kschrief Feb 27, 2024
9849b7c
Versions
kschrief Feb 27, 2024
63c4013
Conflict
kschrief Feb 27, 2024
cf09ec1
Conflict
kschrief Feb 27, 2024
dddf189
Conflict
kschrief Feb 27, 2024
0848c86
Conflict
kschrief Feb 27, 2024
e6171a9
Conflict
kschrief Feb 27, 2024
fa25feb
Finishing touches
kschrief Feb 28, 2024
b2a5c5f
Finishing touches
kschrief Feb 28, 2024
d4690ba
Merge to main
kschrief Feb 28, 2024
e67ba1f
Change next->main script
kschrief Feb 28, 2024
682a750
Better commit message
kschrief Feb 28, 2024
8aab3df
Better commit message
kschrief Feb 28, 2024
3b81a54
Reverse temporary changes
kschrief Mar 8, 2024
40c70b6
Reverse versioning override
kschrief Mar 25, 2024
5ebcecc
Silly change
kschrief Mar 25, 2024
2ca3e70
Forgot to checkout next-major
kschrief Mar 25, 2024
d064d2f
feat: Latest changes
jlacivita Mar 26, 2024
abb4dee
Merge branch 'next' into major/rpc
jlacivita Mar 27, 2024
74136cd
fix: Add promoteAndName
jlacivita Mar 27, 2024
7d70f92
feat: JavaScript now has distinct imports for shared schemas
jlacivita Mar 27, 2024
6980e1b
fix: Propogate namespace based on copySchemasIntoModules
jlacivita Mar 28, 2024
0a45045
feat: Added Gateway
jlacivita Apr 1, 2024
23bc305
Merge branch 'next' into next
kschrief Apr 2, 2024
23ea7c9
Merge pull request #175 from kschrief/next
kschrief Apr 2, 2024
649a17a
fix: Optimized generateAggregateMacros logic
jlacivita Apr 4, 2024
2730b20
fix: Latest changes
jlacivita May 9, 2024
3d3a657
chore: Latest work
jlacivita May 16, 2024
f54ed16
chore: Provider updates
jlacivita Jun 3, 2024
c7190c1
fix: More provider stuff
jlacivita Jun 3, 2024
ebc9b07
Merge branch 'next' into major/rpc
jlacivita Jun 4, 2024
9082dc6
fix: Latest
jlacivita Jun 4, 2024
6930b91
Merge branch 'next' into major/rpc
jlacivita Jun 4, 2024
98268d0
fix: Bugs
jlacivita Jun 5, 2024
3e0b584
fix: Support provider interface in separate file
jlacivita Jun 5, 2024
6a90892
fix: Updating test SDK
jlacivita Jun 6, 2024
8949a47
Merge branch 'next' into major/rpc
jlacivita Jun 6, 2024
d3c7b5c
fix: Merge fixes
jlacivita Jun 6, 2024
8810817
fix: Happy path npm run build working
jlacivita Jun 7, 2024
9305aa7
chore: WIP
jlacivita Jun 7, 2024
131dbb1
fix: Get all tests passing
jlacivita Jun 10, 2024
e52ef87
fix: Validatilon and Transforms
jlacivita Jun 12, 2024
7336ee4
fix: More validiation
jlacivita Jun 12, 2024
b13d4cd
fix: Transforms
jlacivita Jun 12, 2024
7bedf0b
feat: Support for both Bi- and Uni-directional SDKs
jlacivita Jun 18, 2024
8ecb0df
fix: Removed support for ${EXAMPLE:method:index} macro
jlacivita Jun 18, 2024
e2e57bf
fix: Test transport layers back to using string, not json
jlacivita Jun 18, 2024
c096021
feat: Merge anyOf and oneOfs that are mergeable if enableUniionTypes …
jlacivita Jun 25, 2024
31fbf9a
fix: Support bi and uni directional macro injection
jlacivita Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/merge-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Attempt to merge next to main
on:
workflow_dispatch:

jobs:
# Check if next can merge into main
check_merge:
name: Check if "next" can merge into "main"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }}
persist-credentials: true

# Set user identity
- name: Set-Identity
run: |
git config --global user.email "${{ secrets.GLOBAL_GITHUB_EMAIL }}"
git config --global user.name "${{ secrets.GLOBAL_GITHUB_USER }}"

# Checkout "main"
- name: Checkout main
run: git checkout "main"

# Attempt a dry-run merge
- name: Attempt a dry-run merge
run: |
git merge --no-commit --no-ff origin/${{github.ref_name}}
exit $?

# Attempt to merge to main if our dry-run succeeded
process_merge_on_success:
name: Perform merge from "next" to "main"
needs: check_merge
runs-on: ubuntu-latest
if: ${{ success() }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }}
persist-credentials: true

# Set user identity
- name: Set-Identity
run: |
git config --global user.email "${{ secrets.GLOBAL_GITHUB_EMAIL }}"
git config --global user.name "${{ secrets.GLOBAL_GITHUB_USER }}"

# Checkout "main"
- name: Checkout main
run: git checkout "main"

- name: Perform the merge from next to main
run: |
git merge origin/next
merge_status=$?

git push origin "main"
push_status=$?

if [ "$merge_status" -eq 0 ] && [ "$push_status" -eq 0 ]; then
echo "Push to main succeeded"
exit 0
else
exit 1
fi

# If the merge cannot be performed, let stakeholders know
process_merge_on_failure:
name: Merge dry-run failure
needs: check_merge
runs-on: ubuntu-latest
if: ${{ failure() }}

steps:
- name: Post error message (To-Do)
run: echo "Next cannot be merged into main cleanly"

# If we attempted to merge/push to next-main but there was a failure
process_push_failure:
name: Merge failure
needs: process_merge_on_success
runs-on: ubuntu-latest
if: ${{ failure() && needs.process_merge_on_success.result != 'skipped' }}

steps:
- name: Post error message (To-Do)
run: echo "There was a failure when merging next into main"
149 changes: 149 additions & 0 deletions .github/workflows/merge-to-next-major.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Attempt to merge next to next-major
on:
workflow_dispatch:
push:
branches:
- "next"

jobs:
# Check if next can merge into next-major
check_merge:
name: Check if "next" can merge into "next-major"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }}
persist-credentials: true

# Set user identity
- name: Set-Identity
run: |
git config --global user.email "${{ secrets.GLOBAL_GITHUB_EMAIL }}"
git config --global user.name "${{ secrets.GLOBAL_GITHUB_USER }}"

# Checkout "next-major"
- name: Checkout next-major
run: git checkout "next-major"

# Get the "next-major" version number
- name: Extract next-major version
id: extract_version
run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')"

# Checkout "next"
- name: Checkout next
run: git checkout "next"

# Update "next" version to match "next-major"
- name: Update "next" version to match "next-major"
run: |
jq '.version = "${{ steps.extract_version.outputs.version }}"' package.json > temp.json

if diff -q "package.json" "temp.json" >/dev/null; then
echo "Versions are identical. No change required."
rm temp.json
else
mv temp.json package.json
git add package.json && git commit -m "Sync version to ${{ steps.extract_version.outputs.version }}"
fi

# Checkout "next-major"
- name: Checkout next-major
run: git checkout "next-major"

# Attempt a dry-run merge
- name: Attempt a dry-run merge
run: |
git merge --no-commit --no-ff ${{github.ref_name}}
exit $?

# Attempt to merge to next-major if our dry-run succeeded
process_merge_on_success:
name: Perform merge from "next" to "next-major"
needs: check_merge
runs-on: ubuntu-latest
if: ${{ success() }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }}
persist-credentials: true

# Set user identity
- name: Set-Identity
run: |
git config --global user.email "${{ secrets.GLOBAL_GITHUB_EMAIL }}"
git config --global user.name "${{ secrets.GLOBAL_GITHUB_USER }}"

# Checkout "next-major"
- name: Checkout next-major
run: git checkout "next-major"

# Get the "next-major" version number
- name: Extract next-major version
id: extract_version
run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')"

# Checkout "next"
- name: Checkout next
run: git checkout "next"

# Update "next" version to match "next-major"
- name: Update "next" version to match "next-major"
run: |
jq '.version = "${{ steps.extract_version.outputs.version }}"' package.json > temp.json

if diff -q "package.json" "temp.json" >/dev/null; then
echo "Versions are identical. No change required."
rm temp.json
else
mv temp.json package.json
git add package.json && git commit -m "Sync version to ${{ steps.extract_version.outputs.version }}"
fi

# Checkout "next-major"
- name: Checkout next-major
run: git checkout "next-major"

- name: Perform the merge from next to next-major
run: |
git merge next
merge_status=$?

git push origin "next-major"
push_status=$?

if [ "$merge_status" -eq 0 ] && [ "$push_status" -eq 0 ]; then
echo "Push to next-major succeeded"
exit 0
else
exit 1
fi

# If the merge cannot be performed, let stakeholders know
process_merge_on_failure:
name: Merge dry-run failure
needs: check_merge
runs-on: ubuntu-latest
if: ${{ failure() }}

steps:
- name: Post error message (To-Do)
run: echo "Next cannot be merged into next-major cleanly"

# If we attempted to merge/push to next-main but there was a failure
process_push_failure:
name: Merge failure
needs: process_merge_on_success
runs-on: ubuntu-latest
if: ${{ failure() && needs.process_merge_on_success.result != 'skipped' }}

steps:
- name: Post error message (To-Do)
run: echo "There was a failure when merging next into next-major"
1 change: 0 additions & 1 deletion languages/cpp/templates/codeblocks/provider.h

This file was deleted.

1 change: 0 additions & 1 deletion languages/cpp/templates/imports/calls-metrics.cpp

This file was deleted.

1 change: 0 additions & 1 deletion languages/cpp/templates/imports/calls-metrics.impl

This file was deleted.

19 changes: 17 additions & 2 deletions languages/cpp/templates/modules/include/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
#pragma once

#include "error.h"
/* ${IMPORTS} */
/* ${IMPORTS:h} */
${if.callsmetrics}#include "metrics.h"
${end.if.callsmetrics}


${if.declarations}namespace Firebolt {
namespace ${info.Title} {
Expand All @@ -30,7 +33,19 @@ namespace ${info.Title} {
${if.types}
// Types
/* ${TYPES} */${end.if.types}
${if.providers}/* ${PROVIDERS} */${end.if.providers}${if.xuses}/* ${XUSES} */${end.if.xuses}
${if.providers}// Provider Interfaces
struct IProviderSession {
virtual ~IProviderSession() = default;

virtual std::string correlationId() const = 0;
};

struct IFocussableProviderSession : virtual public IProviderSession {
virtual ~IFocussableProviderSession() override = default;

virtual void focus( Firebolt::Error *err = nullptr ) = 0;
};
/* ${PROVIDER_INTERFACES} */${end.if.providers}${if.xuses}/* ${XUSES} */${end.if.xuses}
${if.methods}struct I${info.Title} {

virtual ~I${info.Title}() = default;
Expand Down
4 changes: 2 additions & 2 deletions languages/cpp/templates/modules/src/module_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace Firebolt {
namespace ${info.Title} {
${if.providers}
/* ${PROVIDERS} */${end.if.providers}
/* ${PROVIDER_CLASES} */${end.if.providers}
// Methods
/* ${METHODS} */

Expand All @@ -35,5 +35,5 @@ namespace ${info.Title} {

namespace WPEFramework {

/* ${ENUMS} */
/* ${ENUM_IMPLEMENTATIONS} */
}${end.if.enums}
4 changes: 3 additions & 1 deletion languages/cpp/templates/modules/src/module_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include "FireboltSDK.h"
#include "IModule.h"
/* ${IMPORTS} */
/* ${IMPORTS:impl} */
${if.callsmetrics}#include "metrics_impl.h"
${end.if.callsmetrics}
#include "${info.title.lowercase}.h"

${if.implementations}
Expand Down
2 changes: 1 addition & 1 deletion languages/cpp/templates/schemas/include/common/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "error.h"
/* ${IMPORTS} */
/* ${IMPORTS:h} */

${if.declarations}namespace Firebolt {
namespace ${info.Title} {
Expand Down
2 changes: 1 addition & 1 deletion languages/cpp/templates/schemas/src/jsondata_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#pragma once

/* ${IMPORTS} */
/* ${IMPORTS:jsondata} */
#include "common/${info.title.lowercase}.h"

${if.schemas}namespace Firebolt {
Expand Down
4 changes: 2 additions & 2 deletions languages/cpp/templates/schemas/src/module_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
*/

#include "FireboltSDK.h"
/* ${IMPORTS} */
/* ${IMPORTS:cpp} */
#include "jsondata_${info.title.lowercase}.h"
${if.enums}

namespace WPEFramework {

/* ${ENUMS} */
/* ${ENUM_IMPLEMENTATIONS} */
}${end.if.enums}
2 changes: 1 addition & 1 deletion languages/cpp/templates/sdk/include/firebolt.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct IFireboltAccessor {
// Module Instance methods goes here.
// Instances are owned by the FireboltAcccessor and linked with its lifecycle.

${module.init}
${module.init:h}
};

}
2 changes: 1 addition & 1 deletion languages/cpp/templates/sdk/src/firebolt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace Firebolt {
{
}

${module.init}
${module.init:cpp}
private:
FireboltSDK::Accessor* _accessor;
static FireboltAccessorImpl* _singleton;
Expand Down
14 changes: 0 additions & 14 deletions languages/cpp/templates/sections/provider-interfaces.h

This file was deleted.

6 changes: 5 additions & 1 deletion languages/javascript/language.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
"/index.mjs",
"/defaults.mjs"
],
"templatesPerSchema": [
"/index.mjs"
],
"createModuleDirectories": true,
"copySchemasIntoModules": true,
"copySchemasIntoModules": false,
"mergeOnTitle": true,
"aggregateFiles": [
"/index.d.ts"
],
Expand Down
Loading
Loading