Skip to content

Commit

Permalink
Merge pull request #1385 from balena-io/social_service_account
Browse files Browse the repository at this point in the history
Add typings for the social_service_account resource
  • Loading branch information
thgreasi authored Sep 26, 2023
2 parents 4e54ae8 + d8de677 commit 019db36
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\"",
Expand All @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/types/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export interface JWTUser {
twoFactorRequired?: boolean;
username: string;

/** @deprecated User the social_service_account resource */
social_service_account?: SocialServiceAccount[];
}

export interface SocialServiceAccount {
interface SocialServiceAccount {
provider: string;
display_name: string;
}
11 changes: 10 additions & 1 deletion src/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -571,6 +572,14 @@ export interface SSHKey {
user: NavigationResource<User>;
}

export interface SocialServiceAccount {
// TODO: improve the custom pine client rypings to support resources w/o an id field
id: undefined;
belongs_to__user: NavigationResource<User>;
display_name: string | null;
provider: string;
}

export interface ImageInstall {
id: number;
download_progress: number | null;
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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');
Expand Down
1 change: 0 additions & 1 deletion typing_tests/pine-params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/// <reference types="node" />
import type * as BalenaSdk from '..';
import type { AnyObject } from '../typings/utils';
Expand Down
1 change: 0 additions & 1 deletion typing_tests/pine-typed-result.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/// <reference types="node" />
import type * as BalenaSdk from '..';
import type { AnyObject } from '../typings/utils';
Expand Down

0 comments on commit 019db36

Please sign in to comment.