From 9d001d6de5264c63af037fb9c628e3df6a143731 Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Fri, 22 Sep 2023 16:11:15 +0300 Subject: [PATCH 1/3] Add typings for the social_service_account resource Depends-on: https://github.com/balena-io/balena-api/pull/4623 Change-type: minor --- src/types/jwt.ts | 2 +- src/types/models.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/types/jwt.ts b/src/types/jwt.ts index fb8695259..e52fbcbe9 100644 --- a/src/types/jwt.ts +++ b/src/types/jwt.ts @@ -23,7 +23,7 @@ export interface JWTUser { social_service_account?: SocialServiceAccount[]; } -export interface SocialServiceAccount { +interface SocialServiceAccount { provider: string; display_name: string; } diff --git a/src/types/models.ts b/src/types/models.ts index bae25d20b..5b3fb9802 100644 --- a/src/types/models.ts +++ b/src/types/models.ts @@ -60,6 +60,7 @@ export interface ResourceTypeMap { service_environment_variable: ServiceEnvironmentVariable; service_install: ServiceInstall; service_instance: ServiceInstance; + social_service_account: SocialServiceAccount; subscription: Subscription; subscription_addon_discount: SubscriptionAddonDiscount; subscription_prepaid_addon: SubscriptionPrepaidAddon; @@ -406,7 +407,7 @@ export interface Device { last_vpn_event: string; latitude?: string; local_id?: string; - location: string; + location?: string; longitude?: string; note: string; os_variant?: string; @@ -571,6 +572,14 @@ export interface SSHKey { user: NavigationResource; } +export interface SocialServiceAccount { + // TODO: improve the custom pine client rypings to support resources w/o an id field + id: undefined; + belongs_to__user: NavigationResource; + display_name: string | null; + provider: string; +} + export interface ImageInstall { id: number; download_progress: number | null; From d2854536a6ad8a1656b61045951629dafa82b3af Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Fri, 22 Sep 2023 16:12:30 +0300 Subject: [PATCH 2/3] Deprecate the social_service_account property of the JWTUser Change-type: patch --- src/types/jwt.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/jwt.ts b/src/types/jwt.ts index e52fbcbe9..38537c0c6 100644 --- a/src/types/jwt.ts +++ b/src/types/jwt.ts @@ -20,6 +20,7 @@ export interface JWTUser { twoFactorRequired?: boolean; username: string; + /** @deprecated User the social_service_account resource */ social_service_account?: SocialServiceAccount[]; } From d8de677a8a4aff9b0a0e0c6220cc84369547f80c Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Tue, 26 Sep 2023 14:03:01 +0300 Subject: [PATCH 3/3] Update @balena/lint to 7.2.0 Update @balena/lint from 7.0.1 to 7.2.0 Change-type: patch --- package.json | 4 ++-- tests/integration/setup.ts | 2 -- typing_tests/pine-params.ts | 1 - typing_tests/pine-typed-result.ts | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 13633466f..fd58cb117 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "build": "npm run lint && npm run build-es2015 && npm run build-es2018 && npm run docs", "docs": "jsdoc2md --template doc/DOCUMENTATION.hbs --files \"es2015/**/!(balena-browser*.js)\" > DOCUMENTATION.md", "ci": "npm test && catch-uncommitted", - "lint": "balena-lint -e js -e ts --tests typing_tests typings src tests mjs_tests gulpfile.js", + "lint": "balena-lint -e js -e ts typing_tests typings src tests mjs_tests gulpfile.js", "lint:fix": "balena-lint -e js -e ts --fix typing_tests typings src tests mjs_tests gulpfile.js", "prepack": "npm run build", "watch": "npm run build && watch \"npm run lint\" \"src\" \"tests\"", @@ -64,7 +64,7 @@ "node": ">=16.0" }, "devDependencies": { - "@balena/lint": "^7.0.1", + "@balena/lint": "^7.2.0", "@types/chai": "^4.3.0", "@types/chai-as-promised": "^7.1.4", "@types/lodash": "^4.14.195", diff --git a/tests/integration/setup.ts b/tests/integration/setup.ts index 8d931e639..92f548db4 100644 --- a/tests/integration/setup.ts +++ b/tests/integration/setup.ts @@ -15,7 +15,6 @@ export const IS_BROWSER = typeof window !== 'undefined' && window !== null; export let balenaSdkExports: typeof BalenaSdk; export let sdkOpts: BalenaSdk.SdkOptions; if (IS_BROWSER) { - // eslint-disable-next-line @typescript-eslint/no-var-requires require('js-polyfills/es6'); balenaSdkExports = window.balenaSdk; @@ -26,7 +25,6 @@ if (IS_BROWSER) { process.env.TEST_BUILDER_URL || apiUrl.replace('api.', 'builder.'), }; } else { - // eslint-disable-next-line @typescript-eslint/no-var-requires balenaSdkExports = require('../..'); // eslint-disable-next-line @typescript-eslint/no-var-requires const settings = require('balena-settings-client'); diff --git a/typing_tests/pine-params.ts b/typing_tests/pine-params.ts index 18503afc9..75503a7ee 100644 --- a/typing_tests/pine-params.ts +++ b/typing_tests/pine-params.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ /// import type * as BalenaSdk from '..'; import type { AnyObject } from '../typings/utils'; diff --git a/typing_tests/pine-typed-result.ts b/typing_tests/pine-typed-result.ts index 7b257dfbd..c6f69abeb 100644 --- a/typing_tests/pine-typed-result.ts +++ b/typing_tests/pine-typed-result.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ /// import type * as BalenaSdk from '..'; import type { AnyObject } from '../typings/utils';