@balena/open-balena-api 28.0.6-build-add-tests-for-env-vars-on-state-get-e8aa7f97686dcc3a782649c25dcbbb754c58c65b-1 → 28.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,8 @@
1
1
  import type { sbvrUtils } from '@balena/pinejs';
2
2
  import { errors } from '@balena/pinejs';
3
- export interface ApplicationType {
4
- id?: number;
5
- name: string;
6
- slug: string;
7
- supports_web_url: boolean;
8
- supports_multicontainer: boolean;
9
- supports_gateway_mode: boolean;
10
- requires_payment: boolean;
11
- is_legacy: boolean;
12
- needs__os_version_range: null | string;
13
- maximum_device_count: null | number;
14
- description: string;
15
- }
3
+ import type { Device, ApplicationType as $ApplicationType } from '../../balena-model.js';
4
+ import type { types } from '@balena/pinejs';
5
+ export type ApplicationType = types.OptionalField<Pick<$ApplicationType['Write'], 'id' | 'name' | 'slug' | 'supports_web_url' | 'supports_multicontainer' | 'supports_gateway_mode' | 'requires_payment' | 'is_legacy' | 'needs__os_version_range' | 'maximum_device_count' | 'description'>, 'id'>;
16
6
  export declare const DefaultApplicationType: ApplicationType;
17
7
  export declare class DeviceOSVersionIsTooLow extends errors.ForbiddenError {
18
8
  constructor(message?: string);
@@ -21,5 +11,5 @@ export declare class WebUrlNotSupportedError extends errors.ForbiddenError {
21
11
  constructor(message?: string);
22
12
  }
23
13
  export declare const checkDevicesCanHaveDeviceURL: (api: typeof sbvrUtils.api.resin, deviceIDs: number[]) => Promise<void>;
24
- export declare const checkDeviceCanBeInApplication: (api: typeof sbvrUtils.api.resin, appId: number, device: AnyObject) => Promise<void>;
14
+ export declare const checkDeviceCanBeInApplication: (api: typeof sbvrUtils.api.resin, appId: number, device: Partial<Pick<Device["Read"], "os_version" | "supervisor_version" | "device_name">>) => Promise<void>;
25
15
  export declare const checkDevicesCanBeInApplication: (api: typeof sbvrUtils.api.resin, appId: number, deviceIds: number[]) => Promise<void>;
@@ -83,16 +83,19 @@ const getAppType = async (api, appId) => {
83
83
  });
84
84
  return appType;
85
85
  };
86
+ function checkOsVersionRange(appType) {
87
+ return appType?.needs__os_version_range != null;
88
+ }
86
89
  export const checkDeviceCanBeInApplication = async (api, appId, device) => {
87
90
  const appType = await getAppType(api, appId);
88
- if (appType?.needs__os_version_range == null) {
91
+ if (!checkOsVersionRange(appType)) {
89
92
  return;
90
93
  }
91
94
  checkVersion(device, appType);
92
95
  };
93
96
  export const checkDevicesCanBeInApplication = async (api, appId, deviceIds) => {
94
97
  const appType = await getAppType(api, appId);
95
- if (appType?.needs__os_version_range == null) {
98
+ if (!checkOsVersionRange(appType)) {
96
99
  return;
97
100
  }
98
101
  const devices = await api.get({
@@ -1 +1 @@
1
- {"version":3,"file":"application-types.js","sourceRoot":"","sources":["../../../src/features/application-types/application-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAiBxC,MAAM,CAAC,MAAM,sBAAsB,GAAoB;IACtD,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,KAAK;IACvB,uBAAuB,EAAE,IAAI;IAC7B,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,KAAK;IACvB,SAAS,EAAE,KAAK;IAChB,uBAAuB,EAAE,UAAU;IACnC,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EACV,0EAA0E;CAC3E,CAAC;AAEF,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,cAAc;IACjE,YACC,OAAO,GAAG,wDAAwD;QAElE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD;AAED,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,cAAc;IACjE,YAAY,OAAO,GAAG,gDAAgD;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAChD,GAA+B,EAC/B,SAAmB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QACpE,MAAM,IAAI,uBAAuB,CAChC,UAAU,MAAM,CAAC,WAAW,kDAAkD,OAAO,CAAC,uBAAuB,EAAE,CAC/G,CAAC;IACH,CAAC;IACD,IACC,MAAM,CAAC,UAAU,IAAI,IAAI;QACzB,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACpE,CAAC;QACF,MAAM,IAAI,uBAAuB,CAChC,UAAU,MAAM,CAAC,WAAW,mBAAmB,MAAM,CAAC,UAAU,wCAAwC,OAAO,CAAC,uBAAuB,EAAE,CACzI,CAAC;IACH,CAAC;AACF,CAAC,CAAC"}
1
+ {"version":3,"file":"application-types.js","sourceRoot":"","sources":["../../../src/features/application-types/application-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAyBxC,MAAM,CAAC,MAAM,sBAAsB,GAAoB;IACtD,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,KAAK;IACvB,uBAAuB,EAAE,IAAI;IAC7B,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,KAAK;IACvB,SAAS,EAAE,KAAK;IAChB,uBAAuB,EAAE,UAAU;IACnC,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EACV,0EAA0E;CAC3E,CAAC;AAEF,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,cAAc;IACjE,YACC,OAAO,GAAG,wDAAwD;QAElE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD;AAED,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,cAAc;IACjE,YAAY,OAAO,GAAG,gDAAgD;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAChD,GAA+B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AE,wBAAwB,CAAC,EACtD,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACtB,OAAO;QACR,CAAC;QAED,8FAA8F;QAC9F,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;YACtC,8FAA8F;YAC9F,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACtB,OAAO;QACR,CAAC;QAED,gBAAgB,CAAC,GAAG,EAAE,8BAA8B,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -52,7 +52,7 @@ export declare const auth: {
52
52
  email: string | null;
53
53
  password?: string;
54
54
  }, tx: Tx, req?: Request) => Promise<{ [P in keyof User["Read"]]: import("@balena/abstract-sql-to-typescript").Deferred<User["Read"][P]>; }>;
55
- setPassword: (user: AnyObject, newPassword: string, tx: Tx) => Promise<void>;
55
+ setPassword: (user: Pick<User["Read"], "id">, newPassword: string, tx: Tx) => Promise<void>;
56
56
  updateUserXHR: (res: import("express").Response, req: Request, { tx }: {
57
57
  tx: Tx;
58
58
  }) => Promise<void>;
@@ -62,7 +62,20 @@ export declare const auth: {
62
62
  createScopedAccessToken: typeof createScopedAccessToken;
63
63
  createJwt: (payload: AnyObject, jwtOptions?: jwt.SignOptions) => string;
64
64
  createAllPermissions: typeof createAllPermissions;
65
- setApiKey: (roleName: string, apiKeyPermissions: string[], key: string, tx: Tx) => Promise<AnyObject>;
65
+ setApiKey: (roleName: string, apiKeyPermissions: string[], key: string, tx: Tx) => Promise<import("@balena/abstract-sql-to-typescript").PickDeferred<{
66
+ created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
67
+ modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
68
+ id: import("@balena/sbvr-types").Types["Serial"]["Read"];
69
+ key: import("@balena/sbvr-types").Types["Short Text"]["Read"];
70
+ expiry_date: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
71
+ is_of__actor: {
72
+ __id: import("@balena/pinejs/out/sbvr-api/user.js").Actor["Read"]["id"];
73
+ } | [import("@balena/pinejs/out/sbvr-api/user.js").Actor["Read"]];
74
+ name: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
75
+ description: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
76
+ api_key__has__role?: Array<import("@balena/pinejs/out/sbvr-api/user.js").ApiKeyHasRole["Read"]>;
77
+ api_key__has__permission?: Array<import("@balena/pinejs/out/sbvr-api/user.js").ApiKeyHasPermission["Read"]>;
78
+ }, "id" | "key">>;
66
79
  getOrInsertPermissionId: (name: string, tx: Tx) => Promise<{
67
80
  id: number;
68
81
  }>;
@@ -127,10 +140,10 @@ export declare const hooks: {
127
140
  addDeleteHookForDependents: (resource: string, dependents: Parameters<typeof import("./infra/cascade-delete/index.js").addDeleteHookForDependents>[2]) => void;
128
141
  };
129
142
  export declare const utils: {
130
- updateOrInsertModel: <T extends keyof import("./balena-model.js").default>(resource: T, filter: import("pinejs-client-core").FilterObj<import("./balena-model.js").default[T]["Read"]>, updateFields: AnyObject, tx?: Tx) => Promise<{
143
+ updateOrInsertModel: <T extends keyof import("./balena-model.js").default>(resource: T, filter: import("pinejs-client-core").FilterObj<import("./balena-model.js").default[T]["Read"]>, updateFields: Partial<import("./balena-model.js").default[T]["Write"]>, tx?: Tx) => Promise<{
131
144
  id: number;
132
145
  }>;
133
- getOrInsertModelId: (resource: string, body: AnyObject, tx?: Tx) => Promise<{
146
+ getOrInsertModelId: <T extends keyof import("./balena-model.js").default>(resource: T, body: Partial<import("./balena-model.js").default[T]["Write"]>, tx?: Tx) => Promise<{
134
147
  id: number;
135
148
  }>;
136
149
  getIP: (req: Request) => string | undefined;
@@ -11,7 +11,7 @@ export declare const setRegistrationRoleFunc: (registerFunc: GetNewUserRoleFunct
11
11
  export declare const getRegistrationRole: typeof getNewUserRole;
12
12
  export declare const comparePassword: (password: string, hash: string | null) => Promise<boolean>;
13
13
  export declare const validatePassword: (password?: string) => void;
14
- export declare const setPassword: (user: AnyObject, newPassword: string, tx: Tx) => Promise<void>;
14
+ export declare const setPassword: (user: Pick<User["Read"], "id">, newPassword: string, tx: Tx) => Promise<void>;
15
15
  export declare const updatePasswordIfNeeded: (usernameOrEmail: string, newPassword: string, tx: Tx) => Promise<boolean>;
16
16
  export declare const checkUserPassword: (password: string, userId: number, tx: Tx) => Promise<void>;
17
17
  export declare const reqHasPermission: (req: Pick<Request, "apiKey" | "user">, permission: string) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/infra/auth/auth.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAGvB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAO3C,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;AACrE,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAChC,IAAiC,EACjC,UAAkB,EACR,EAAE;IACZ,IAAI,IAAI,EAAE,WAAW,IAAI,IAAI,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC9C,CAAC,CAAC;AAIF,IAAI,cAAc,GAA2B,GAAG,EAAE,CAAC,c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AAE;IACtE,IAAI,QAAQ,CAAC;IACb,IAAI,GAAG,EAAE,CAAC;QACT,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,kCAAkC;IAClC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE;YACL,GAAG,QAAQ;SACX;QACD,WAAW,EAAE;YACZ,EAAE;YACF,GAAG,EAAE,WAAW,CAAC,IAAI;YACrB,MAAM,EAAE;gBACP,QAAQ;aACR;SACD;KACD,CAAC,CAAC;IAEH,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC"}
@@ -16,7 +16,20 @@ export declare const assignUserPermission: (user: number, permission: number, tx
16
16
  id: number;
17
17
  }>;
18
18
  export declare const revokeUserRole: (user: number, role: number, tx: Tx) => Promise<void>;
19
- export declare const setApiKey: (roleName: string, apiKeyPermissions: string[], key: string, tx: Tx) => Promise<AnyObject>;
19
+ export declare const setApiKey: (roleName: string, apiKeyPermissions: string[], key: string, tx: Tx) => Promise<import("@balena/abstract-sql-to-typescript").PickDeferred<{
20
+ created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
21
+ modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
22
+ id: import("@balena/sbvr-types").Types["Serial"]["Read"];
23
+ key: import("@balena/sbvr-types").Types["Short Text"]["Read"];
24
+ expiry_date: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
25
+ is_of__actor: {
26
+ __id: import("@balena/pinejs/out/sbvr-api/user.js").Actor["Read"]["id"];
27
+ } | [import("@balena/pinejs/out/sbvr-api/user.js").Actor["Read"]];
28
+ name: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
29
+ description: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
30
+ api_key__has__role?: Array<import("@balena/pinejs/out/sbvr-api/user.js").ApiKeyHasRole["Read"]>;
31
+ api_key__has__permission?: Array<import("@balena/pinejs/out/sbvr-api/user.js").ApiKeyHasPermission["Read"]>;
32
+ }, "id" | "key">>;
20
33
  export type PermissionSet = string[];
21
34
  export interface RolePermissionsMap {
22
35
  [roleName: string]: PermissionSet;
@@ -35,5 +48,5 @@ export declare function createAllPermissions(tx: Tx, permissionNames: Permission
35
48
  roles: Dictionary<{
36
49
  id: number;
37
50
  }>;
38
- apiKeys: any[];
51
+ apiKeys: (string | undefined)[];
39
52
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/infra/auth/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CACrC,KAAK,IAAqB,EAAE;IAC3B,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,EAAE,CAAC,eAAe,CAC/C,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CACpD,CAAC;IACF,IAAI,KAAK,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAA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AAY,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YAE/D,IAAI,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO,MAAM,CAAC,GAAG,CAAC;YACnB,CAAC;YACD,MAAM,KAAK,CAAC,KAAK,CAAC;gBACjB,QAAQ,EAAE,SAAS;gBACnB,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,IAAI,EAAE;oBACL,GAAG;iBACH;aACD,CAAC,CAAC;YACH,+CAA+C;YAC/C,+BAA+B;YAC/B,OAAO,GAAG,CAAC;QACZ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,QAAQ,WAAW,CAAC,CAAC;QAC9D,CAAC;IACF,CAAC,CACD,CACD,CAAC;IAEF,OAAO,MAAM,QAAQ,CAAC,KAAK,CAAC;QAC3B,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,cAAc;KACvB,CAAC,CAAC;AACJ,CAAC"}
@@ -3,12 +3,12 @@ import type BalenaModel from '../../balena-model.js';
3
3
  export declare const getOrInsertId: (resource: string, body: AnyObject, tx?: Tx) => Promise<{
4
4
  id: number;
5
5
  }>;
6
- export declare const getOrInsertModelId: (resource: string, body: AnyObject, tx?: Tx) => Promise<{
6
+ export declare const getOrInsertModelId: <T extends keyof BalenaModel>(resource: T, body: Partial<BalenaModel[T]["Write"]>, tx?: Tx) => Promise<{
7
7
  id: number;
8
8
  }>;
9
9
  export declare const updateOrInsert: (resource: string, filter: FilterObj, updateFields: AnyObject, tx?: Tx) => Promise<{
10
10
  id: number;
11
11
  }>;
12
- export declare const updateOrInsertModel: <T extends keyof BalenaModel>(resource: T, filter: FilterObj<BalenaModel[T]["Read"]>, updateFields: AnyObject, tx?: Tx) => Promise<{
12
+ export declare const updateOrInsertModel: <T extends keyof BalenaModel>(resource: T, filter: FilterObj<BalenaModel[T]["Read"]>, updateFields: Partial<BalenaModel[T]["Write"]>, tx?: Tx) => Promise<{
13
13
  id: number;
14
14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  "name": "@balena/open-balena-api",
3
3
  "description": "Internet of things, Made Simple",
4
- "version": "28.0.6-build-add-tests-for-env-vars-on-state-get-e8aa7f97686dcc3a782649c25dcbbb754c58c65b-1",
4
+ "version": "28.0.6",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -168,6 +168,6 @@
168
168
  "loader": "ts-node/esm/transpile-only"
169
169
  },
170
170
  "versionist": {
171
- "publishedAt": "2024-09-18T15:20:07.847Z"
171
+ "publishedAt": "2024-09-18T15:06:42.662Z"
172
172
  }
173
173
  }