@crowdin/app-project-module 0.30.2 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ {
2
+ "git": {
3
+ "push": true,
4
+ "commit": true,
5
+ "commitMessage": "chore: version ${version} [skip ci]",
6
+ "requireBranch": "master",
7
+ "tag": true
8
+ },
9
+ "github": {
10
+ "release": true,
11
+ "autoGenerate": true,
12
+ "releaseName": "${version}"
13
+ },
14
+ "npm": {
15
+ "publish": false
16
+ }
17
+ }
package/CONTRIBUTING.md CHANGED
@@ -65,6 +65,9 @@ Before sending your pull requests, make sure you followed the list below:
65
65
  - Ensure that there are unit tests for your code.
66
66
  - Run unit tests.
67
67
 
68
+ > **Note**
69
+ > This project uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit messages and PR titles.
70
+
68
71
  ##### Contributing to the docs
69
72
 
70
73
  First of all, you need to install Python (v3). Then install dependencies:
@@ -57,6 +57,12 @@ function handle(config, integration) {
57
57
  options.integrationSearchListener = integration.integrationSearchListener;
58
58
  options.checkSubscription = !(0, connection_1.isAppFree)(config);
59
59
  options.uploadTranslations = integration.uploadTranslations;
60
+ options.sentryData = config.sentryDsn
61
+ ? {
62
+ dsn: config.sentryDsn,
63
+ appIdentifier: config.identifier,
64
+ }
65
+ : null;
60
66
  (0, util_1.log)(`Routing user to ${view} view`, config.logger);
61
67
  return res.render(view, options);
62
68
  }), config.onError);
@@ -194,19 +194,10 @@ function handle(config) {
194
194
  events['subscription_paid'] = '/subscription-paid';
195
195
  }
196
196
  return (_req, res) => {
197
- const manifest = {
198
- identifier: config.identifier,
199
- name: config.name,
200
- logo: (0, util_1.getLogoUrl)(config),
201
- baseUrl: config.baseUrl,
202
- authentication: {
197
+ const manifest = Object.assign(Object.assign({ identifier: config.identifier, name: config.name, logo: (0, util_1.getLogoUrl)(config), baseUrl: config.baseUrl, authentication: {
203
198
  type: config.authenticationType || models_1.AuthenticationType.APP,
204
199
  clientId: config.clientId,
205
- },
206
- events,
207
- scopes: config.scopes ? config.scopes : [models_1.Scope.PROJECTS],
208
- modules,
209
- };
200
+ }, events, scopes: config.scopes ? config.scopes : [models_1.Scope.PROJECTS] }, (config.defaultPermissions && { default_permissions: config.defaultPermissions })), { modules });
210
201
  res.send(manifest);
211
202
  };
212
203
  }
package/out/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Express } from 'express';
2
2
  import { ClientConfig, Config, CrowdinAppUtilities } from './models';
3
3
  import express from './util/terminus-express';
4
- export { Scope } from './models';
4
+ export { Scope, UserPermissions, ProjectPermissions } from './models';
5
5
  export { express };
6
6
  export declare function addCrowdinEndpoints(app: Express, clientConfig: Config | ClientConfig): CrowdinAppUtilities;
7
7
  export declare function createApp(clientConfig: ClientConfig): void;
package/out/index.js CHANGED
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.createApp = exports.addCrowdinEndpoints = exports.express = exports.Scope = void 0;
38
+ exports.createApp = exports.addCrowdinEndpoints = exports.express = exports.ProjectPermissions = exports.UserPermissions = exports.Scope = void 0;
39
39
  const express_handlebars_1 = __importDefault(require("express-handlebars"));
40
40
  const cron = __importStar(require("node-cron"));
41
41
  const path_1 = require("path");
@@ -84,6 +84,8 @@ exports.express = terminus_express_1.default;
84
84
  const webhooks_1 = require("./util/webhooks");
85
85
  var models_2 = require("./models");
86
86
  Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return models_2.Scope; } });
87
+ Object.defineProperty(exports, "UserPermissions", { enumerable: true, get: function () { return models_2.UserPermissions; } });
88
+ Object.defineProperty(exports, "ProjectPermissions", { enumerable: true, get: function () { return models_2.ProjectPermissions; } });
87
89
  function addCrowdinEndpoints(app, clientConfig) {
88
90
  var _a, _b, _c, _d, _e, _f, _g;
89
91
  const config = (0, defaults_1.convertClientConfig)(clientConfig);
@@ -48,6 +48,10 @@ export interface ClientConfig extends ImagePath {
48
48
  * app description
49
49
  */
50
50
  description: string;
51
+ /**
52
+ * Set default app permissions
53
+ */
54
+ defaultPermissions?: DefaultPermissions;
51
55
  /**
52
56
  * port where to start express application
53
57
  */
@@ -143,6 +147,10 @@ export interface ClientConfig extends ImagePath {
143
147
  filePostImport?: FilePostImportLogic;
144
148
  filePreExport?: FilePreExportLogic;
145
149
  filePostExport?: FilePostExportLogic;
150
+ /**
151
+ * sentry dsn identifier of sentry project
152
+ */
153
+ sentryDsn?: string;
146
154
  }
147
155
  export type Config = ClientConfig & {
148
156
  baseUrl: string;
@@ -884,4 +892,17 @@ export interface IntegrationSyncedFiles {
884
892
  integrationId: string;
885
893
  crowdinId: string;
886
894
  }
895
+ export declare enum UserPermissions {
896
+ OWNER = "owner",
897
+ MANAGERS = "managers",
898
+ ALL_MEMBERS = "all"
899
+ }
900
+ export declare enum ProjectPermissions {
901
+ OWN = "own",
902
+ RESTRICTED = "restricted"
903
+ }
904
+ export interface DefaultPermissions {
905
+ user?: UserPermissions;
906
+ project?: ProjectPermissions;
907
+ }
887
908
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SyncType = exports.SyncCondition = exports.RequestMethods = exports.Provider = exports.ContextOptionsTypes = exports.ContextOptionsLocations = exports.EditorPanelsMode = exports.ProcessFileJobType = exports.SubscriptionInfoType = exports.AccountType = exports.Scope = exports.AuthenticationType = void 0;
3
+ exports.ProjectPermissions = exports.UserPermissions = exports.SyncType = exports.SyncCondition = exports.RequestMethods = exports.Provider = exports.ContextOptionsTypes = exports.ContextOptionsLocations = exports.EditorPanelsMode = exports.ProcessFileJobType = exports.SubscriptionInfoType = exports.AccountType = exports.Scope = exports.AuthenticationType = void 0;
4
4
  var AuthenticationType;
5
5
  (function (AuthenticationType) {
6
6
  AuthenticationType["CODE"] = "authorization_code";
@@ -91,3 +91,14 @@ var SyncType;
91
91
  SyncType[SyncType["SCHEDULE"] = 1] = "SCHEDULE";
92
92
  SyncType[SyncType["WEBHOOKS"] = 2] = "WEBHOOKS";
93
93
  })(SyncType = exports.SyncType || (exports.SyncType = {}));
94
+ var UserPermissions;
95
+ (function (UserPermissions) {
96
+ UserPermissions["OWNER"] = "owner";
97
+ UserPermissions["MANAGERS"] = "managers";
98
+ UserPermissions["ALL_MEMBERS"] = "all";
99
+ })(UserPermissions = exports.UserPermissions || (exports.UserPermissions = {}));
100
+ var ProjectPermissions;
101
+ (function (ProjectPermissions) {
102
+ ProjectPermissions["OWN"] = "own";
103
+ ProjectPermissions["RESTRICTED"] = "restricted";
104
+ })(ProjectPermissions = exports.ProjectPermissions || (exports.ProjectPermissions = {}));