Skip to content

Commit

Permalink
fix: Move provider stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Jun 3, 2024
1 parent 45dacf5 commit 7c6b8c9
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 31 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"validate:each": "npx firebolt-openrpc validate --input src/openrpc --schemas src/schemas --transformations",
"validate:compiled": "npx firebolt-openrpc validate --input dist/firebolt-open-rpc.json && npm run validate --workspaces",
"validate": "npm run validate:each && npm run validate:compiled ",
"compile": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --server ./dist/firebolt-open-rpc.json --client ./dist/firebolt-app-open-rpc.json --schemas src/schemas",
"compile": "npm run compile2",
"compile1": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --server ./dist/firebolt-open-rpc.json --schemas src/schemas",
"compile2": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --server ./dist/firebolt-open-rpc.json --client ./dist/firebolt-app-open-rpc.json --schemas src/schemas",
"update": "npx firebolt-openrpc update --input src --schemas src/schemas",
"slice": "npm run slice --workspaces",
"sdk": "npm run sdk --workspaces",
Expand Down
13 changes: 10 additions & 3 deletions requirements/specifications/general/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ If a Firebolt App has registered as a capability provider, e.g. "xrn:firebolt:ca
The app **MUST** respond either either a result or an error.

#### 3.4.1. Interface OpenRPC Extension
The Platform provider registration API **MUST** have a `provider` tag and an `x-interface` string parameter denoting the name of the interface from the Application OpenRPC that this registration API is enabling.
The Platform provider registration API **MUST** have a `registration` tag and an `x-interface` string parameter denoting the name of the interface from the Application OpenRPC that this registration API is enabling.

```json
{
Expand All @@ -291,7 +291,7 @@ The Platform provider registration API **MUST** have a `provider` tag and an `x-
"name": "Sky.provideSun",
"tags": [
{
"name": "provider",
"name": "registration",
"x-interface": "Sun"
}
],
Expand Down Expand Up @@ -330,6 +330,13 @@ The Application OpenRPC definition for the interface **MUST** have one or more m
},
{
"name": "Sun.set",
"tags": [
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:sky:sun",
"x-allow-focus": true
}
],
"params": []
}
]
Expand Down Expand Up @@ -366,7 +373,7 @@ The Firebolt Implementation OpenRPC would include:
"name": "Lifecycle.provideApplication",
"tags": [
{
"name": "provider",
"name": "registration",
"x-interface": "Application"
}
],
Expand Down
9 changes: 6 additions & 3 deletions src/openrpc/keyboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
"tags": [
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:input:keyboard"
"x-provides": "xrn:firebolt:capability:input:keyboard",
"x-allow-focus": true
}
],
"summary": "Prompt the user for their email address with a simplified list of choices.",
Expand Down Expand Up @@ -246,7 +247,8 @@
"tags": [
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:input:keyboard"
"x-provides": "xrn:firebolt:capability:input:keyboard",
"x-allow-focus": true
}
],
"summary": "Show the password entry keyboard, with typing obfuscated from visibility",
Expand Down Expand Up @@ -288,7 +290,8 @@
"tags": [
{
"name": "capabilities",
"x-provides": "xrn:firebolt:capability:input:keyboard"
"x-provides": "xrn:firebolt:capability:input:keyboard",
"x-allow-focus": true
}
],
"summary": "Show the standard platform keyboard, and return the submitted value",
Expand Down
4 changes: 3 additions & 1 deletion src/sdks/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"type": "module",
"scripts": {
"validate": "npx firebolt-openrpc validate --input ./dist/firebolt-open-rpc.json",
"sdk": "npx firebolt-openrpc sdk --server ./dist/firebolt-open-rpc.json --client ./dist/firebolt-app-open-rpc.json --template ./src/js --output ./build/javascript/src",
"sdk": "npm run sdk1",
"sdk1": "npx firebolt-openrpc sdk --server ./dist/firebolt-open-rpc.json --template ./src/js --output ./build/javascript/src",
"sdk2": "npx firebolt-openrpc sdk --server ./dist/firebolt-open-rpc.json --client ./dist/firebolt-app-open-rpc.json --template ./src/js --output ./build/javascript/src",
"native": "npx firebolt-openrpc sdk --server ./dist/firebolt-open-rpc.json --client ./dist/firebolt-app-open-rpc.json --template ./src/cpp --output ./build/c/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp",
"compile": "cd ../../.. && npm run compile",
"slice": "npm run slice:server; npm run slice:client",
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/core/src/js/sdk/Device/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function version() {
export default {

/* ${EVENTS_ENUM} */
/* ${ENUMS} */
/* ${ENUM_IMPLEMENTATIONS} */

version,
/* ${METHOD_LIST} */
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/core/src/js/sdk/Lifecycle/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default {

/* ${EVENTS_ENUM} */

/* ${ENUMS} */
/* ${ENUM_IMPLEMENTATIONS} */

ready,
state,
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/core/src/js/sdk/Metrics/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function signOut() {
export default {

/* ${EVENTS_ENUM} */
/* ${ENUMS} */
/* ${ENUM_IMPLEMENTATIONS} */
/* ${METHOD_LIST} */

}
Expand Down
23 changes: 4 additions & 19 deletions src/sdks/manage/test/suite/acknowledgeChallenge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,17 @@
import { test, expect } from "@jest/globals";
import { AcknowledgeChallenge } from "../../build/javascript/src/firebolt-manage";

class ACKPovider implements AcknowledgeChallenge.ChallengeProvider {
challenge(
parameters: object,
session: AcknowledgeChallenge.FocusableProviderSession
): Promise<AcknowledgeChallenge.GrantResult> {
return Promise.resolve(null);
class ACKPovider implements AcknowledgeChallenge.AcknowledgeChallenge {
challenge(capability: string, requestor: AcknowledgeChallenge.ChallengeRequestor): Promise<AcknowledgeChallenge.GrantResult> {
return Promise.resolve(null)
}
}

test("AcknowledgeChallenge.provide() declarations", () => {
AcknowledgeChallenge.provide(
"xrn:firebolt:capability:usergrant:acknowledgechallenge",
new ACKPovider()
);
AcknowledgeChallenge.provide(new ACKPovider());
expect(1).toBe(1);
});

test("AcknowledgeChallenge.provide() with blank object", () => {
expect(() => {
AcknowledgeChallenge.provide(
"xrn:firebolt:capability:usergrant:acknowledgechallenge",
{}
);
}).toThrow();
});

// Events Test cases

// test("AcknowledgeChallenge.listen() for requestChallenge event", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/manage/test/suite/device.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { test, expect } from "@jest/globals";
import { Device } from "../../build/javascript/src/firebolt-manage";

test("Device.name()", () => {
return Device.name(() => {}).then((res: number) => {
return Device.name((n:string) => {}).then((res: number) => {
expect(res > 0).toBe(true);
});
});
Expand Down

0 comments on commit 7c6b8c9

Please sign in to comment.