Skip to content

Commit

Permalink
Merge branch 'next' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancooley committed Nov 13, 2023
2 parents 319feed + acd2012 commit 00c6e21
Show file tree
Hide file tree
Showing 712 changed files with 24,467 additions and 6,729 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ HORIZON_PREFIX=horizon:
DOCKER_SHARED_MEMORY=256m
PROXIES=*
LOGOUT_OTHER_DEVICES=false
BROWSER_CACHE=true
BROWSER_CACHE=true
VUE_APP_WEBSOCKET_PROVIDER=socket.io
VUE_APP_WEBSOCKET_PROVIDER_URL=ws:127.0.0.1:1234
VUE_APP_COLLABORATIVE_ENABLED=true
9 changes: 6 additions & 3 deletions .github/workflows/deploy-pm4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ env:
GITHUB_COMMENT: ${{ secrets.GH_COMMENT }}
pull_req_id: ${{github.event.pull_request.number}}
BASE: ${{ contains(github.event.pull_request.body, 'ci:next') && 'ci-base-php82' || 'ci-base' }}
CDATA_LICENSE_DOCUSIGN: ${{ secrets.CDATA_LICENSE_DOCUSIGN }}
CDATA_LICENSE_EXCEL: ${{ secrets.CDATA_LICENSE_EXCEL }}
CDATA_LICENSE_GITHUB: ${{ secrets.CDATA_LICENSE_GITHUB }}
CDATA_LICENSE_SLACK: ${{ secrets.CDATA_LICENSE_SLACK }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -69,9 +73,9 @@ jobs:
if: contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule'
run: |
cd pm4-stm-docker
docker-compose build --no-cache base
docker-compose build --no-cache base-php82
docker-compose build --no-cache cache
docker push ${REPOSITORY}:ci-base
docker push ${REPOSITORY}:ci-base-php82
docker push ${REPOSITORY}:ci-cache
- name: Build and Push the image to ECR
run: |
Expand Down Expand Up @@ -206,4 +210,3 @@ jobs:
cd pm4-stm-docker/deploy-stm
composer install --no-dev
php run-delete-instance.php
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ cypress/downloads
.php-cs-fixer.cache
.phpunit.result.cache
.editorconfig
resources/lang/de
resources/lang/es
resources/lang/fr
5 changes: 3 additions & 2 deletions ProcessMaker/Console/Commands/BuildScriptExecutors.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function buildExecutor()
$success = $this->associateWithExistingImage($scriptExecutor);
if ($success) {
$this->info('Docker Image Associated');

// we associated with an existing image, no need to build
return;
} else {
Expand Down Expand Up @@ -141,7 +142,7 @@ public function buildExecutor()
$cmd .= ' --user-id=' . $this->userId;
}
$this->artisan($cmd);
$this->info("SDK is at ${sdkDir}");
$this->info("SDK is at {$sdkDir}");
}

$dockerfile = ScriptExecutor::initDockerfile($lang) . "\n" . $scriptExecutor->config;
Expand All @@ -152,7 +153,7 @@ public function buildExecutor()
$this->info('Building the docker executor');

$image = $scriptExecutor->dockerImageName();
$command = Docker::command() . " build --build-arg SDK_DIR=/sdk -t ${image} -f ${packagePath}/Dockerfile.custom ${packagePath}";
$command = Docker::command() . " build --build-arg SDK_DIR=/sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}";

if ($this->userId) {
$this->runProc(
Expand Down
49 changes: 49 additions & 0 deletions ProcessMaker/Console/Commands/ProcessMakerLicenseRemove.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace ProcessMaker\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;

class ProcessMakerLicenseRemove extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'processmaker:license-remove';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Remove the license.json file from the system';

/**
* Execute the console command.
*
* @return int
*/
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
if (Storage::disk('local')->exists('license.json')) {
if ($this->confirm('Are you sure you want to remove the license.json file?')) {
Storage::disk('local')->delete('license.json');
$this->info('license.json removed successfully!');
} else {
$this->info('Operation cancelled. license.json was not removed.');
}
} else {
$this->error('license.json does not exist on the local disk.');
}

return 0;
}
}
91 changes: 91 additions & 0 deletions ProcessMaker/Console/Commands/ProcessMakerLicenseUpdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

namespace ProcessMaker\Console\Commands;

use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;

class ProcessMakerLicenseUpdate extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'processmaker:license-update {licenseFile}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Update the license from a given URL or local path and store it in local disk';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$input = $this->argument('licenseFile');

try {
$content = file_get_contents($input);
if (!$this->isValidLicenseContent($content)) {
return 1;
}

Storage::disk('local')->put('license.json', $content);

Artisan::call('package:discover');
$this->info('License updated successfully');
} catch (Exception $e) {
$this->error('An error occurred: ' . $e->getMessage());
}

return 0;
}

/**
* Validates the license content.
*
* @param string $content
* @return bool
*/
protected function isValidLicenseContent(string $content): bool
{
$data = json_decode($content, true);

if (json_last_error() !== JSON_ERROR_NONE) {
$this->error('The provided license does not have a valid format.');

return false;
}

if (!isset($data['expires_at']) || !is_string($data['expires_at'])) {
$this->error('The provided license does not have a valid "expires_at" property.');

return false;
}

try {
Carbon::parse($data['expires_at']);
} catch (Exception $e) {
$this->error('The "expires_at" property is not a valid date.');
return false;
}

if (!isset($data['packages']) || !is_array($data['packages'])) {
$this->error('The provided license does not have a valid "packages" property.');

return false;
}

return true;
}
}
2 changes: 1 addition & 1 deletion ProcessMaker/Console/Commands/ProcessMakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function checkMigrationStatus()
private function testHorizonService()
{
$testDispatchNow = 'Test immediate Jobs';
TestStatusJob::dispatchNow($testDispatchNow);
TestStatusJob::dispatchSync($testDispatchNow);
$this->waitTestPassed($testDispatchNow, 5);

$testDelayedWorkers = 'Test dispatch Jobs';
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Console/Commands/SyncDefaultTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle()
$randomDelay = random_int(10, 120);
Job::dispatch()->delay(now()->addMinutes($randomDelay));
} else {
Job::dispatchNow();
Job::dispatchSync();
}

return 0;
Expand Down
10 changes: 9 additions & 1 deletion ProcessMaker/Contracts/WorkflowManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,19 @@ public function existsServiceImplementation($implementation);
/**
* Run the service task implementation
* @param string $implementation
* @param array $dat
* @param array $data
* @param array $config
* @param string $tokenId
*
* @return mixed
*/
public function runServiceImplementation($implementation, array $data, array $config, $tokenId = '');

/**
* Get the service task class implementation
*
* @param string $implementation
* @return string
*/
public function getServiceClassImplementation($implementation);
}
25 changes: 25 additions & 0 deletions ProcessMaker/Enums/ExporterMap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace ProcessMaker\Enums;

enum ExporterMap
{
const TYPES = [
'screen' => [\ProcessMaker\Models\Screen::class, \ProcessMaker\ImportExport\Exporters\ScreenExporter::class],
'process' => [\ProcessMaker\Models\Process::class, \ProcessMaker\ImportExport\Exporters\ProcessExporter::class],
'script' => [\ProcessMaker\Models\Script::class, \ProcessMaker\ImportExport\Exporters\ScriptExporter::class],
'process_templates' => [\ProcessMaker\Models\ProcessTemplates::class, \ProcessMaker\ImportExport\Exporters\TemplateExporter::class],
'data_source' => [\ProcessMaker\Packages\Connectors\DataSources\Models\DataSource::class, \ProcessMaker\Packages\Connectors\DataSources\ImportExport\DataSourceExporter::class],
'decision_table' => [\ProcessMaker\Package\PackageDecisionEngine\Models\DecisionTable::class, \ProcessMaker\Package\PackageDecisionEngine\ImportExport\DecisionTableExporter::class],
];

public static function getModelClass(string $type): ?string
{
return self::TYPES[$type][0] ?? null;
}

public static function getExporterClass(string $type): ?string
{
return self::TYPES[$type][1] ?? null;
}
}
59 changes: 59 additions & 0 deletions ProcessMaker/Events/CommentsUpdated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace ProcessMaker\Events;

use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class CommentsUpdated implements ShouldBroadcastNow
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $users;

/**
* Create a new event instance.
*/
public function __construct($users)
{
$this->users = $users;
}

/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
$channels = [];
foreach ($this->users as $user) {
$channels[] = new PrivateChannel("ProcessMaker.Models.User.{$user->id}");
}
return $channels;
}

/**
* Set the event name
*
* @return string
*/
public function broadcastAs()
{
return 'CommentsUpdated';
}

/**
* Set the data to broadcast with this event
*
* @return array
*/
public function broadcastWith()
{
return [];
}
}
5 changes: 5 additions & 0 deletions ProcessMaker/Events/CustomizeUiUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ class CustomizeUiUpdated implements SecurityLogEventInterface
use FormatSecurityLogChanges;

private array $data;

private array $changes;

private array $original;

private bool $reset;

private string $defaultVariables = '[
{"id":"$primary","value":"#0872C2","title":"Primary"},
{"id":"$secondary","value":"#6C757D","title":"Secondary"},
Expand All @@ -27,6 +31,7 @@ class CustomizeUiUpdated implements SecurityLogEventInterface
{"id":"$dark","value":"#000000","title":"Dark"},
{"id":"$light","value":"#FFFFFF","title":"Light"}
]';

private string $defaultFont = '{"id":"\'Open Sans\'","title":"Default Font"}';

/**
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Exception/HttpResponseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public function __construct(Response $response, $note = null)
]), 0);
}

public function getStatusCode()
public function getStatusCode(): int
{
return $this->status;
}

public function getHeaders()
public function getHeaders(): array
{
return $this->headers;
}
Expand Down
10 changes: 10 additions & 0 deletions ProcessMaker/Exception/ProjectAssetSyncException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace ProcessMaker\Exception;

use Exception;

class ProjectAssetSyncException extends Exception
{
protected $message = 'Error syncing project assets.';
}
2 changes: 1 addition & 1 deletion ProcessMaker/Exception/ReferentialIntegrityException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace ProcessMaker\Exception;

use Exception;
use ProcessMaker\Models\ProcessMakerModel;
use Illuminate\Database\Eloquent\Model;
use ProcessMaker\Models\ProcessMakerModel;

class ReferentialIntegrityException extends Exception
{
Expand Down
Loading

0 comments on commit 00c6e21

Please sign in to comment.