GitHub(nextgroup2706/ken_nogi)は今後使わず自社Gitea運用に切替え。 NodeSrvは旧リポジトリの履歴を破棄しファイルのみ統合(Dokploy用サービスアカウントは 別途mygit-admin/NodeSrv.gitに履歴あり)。notepmエクスポート(12GB)とPleasanter インストーラzip(208MB)はサイズが大きいため.gitignoreで除外。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
71 lines
2.4 KiB
JavaScript
71 lines
2.4 KiB
JavaScript
"use strict";
|
|
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
|
|
const dataDir = path.join(__dirname, "..", "data", "test-import-maps");
|
|
const usersJson = fs.readFileSync(path.join(dataDir, "mock-pleasanter-users.json"), "utf8");
|
|
const deptsJson = fs.readFileSync(path.join(dataDir, "mock-pleasanter-depts.json"), "utf8");
|
|
|
|
const jsCode = [
|
|
"const USERS = " + usersJson + ";",
|
|
"const DEPTS = " + deptsJson + ";",
|
|
"const q = $json.query || {};",
|
|
"const b = $json.body || {};",
|
|
"const kind = q.kind || b.kind || '';",
|
|
"if (kind === 'users') {",
|
|
" return [{ json: { Response: { Offset: 0, PageSize: USERS.length, TotalCount: USERS.length, Data: USERS } } }];",
|
|
"}",
|
|
"if (kind === 'depts') {",
|
|
" return [{ json: { Response: { Offset: 0, PageSize: DEPTS.length, TotalCount: DEPTS.length, Data: DEPTS } } }];",
|
|
"}",
|
|
"return [{ json: { StatusCode: 400, Message: 'unknown kind: ' + kind } }];",
|
|
].join("\n");
|
|
|
|
const workflow = {
|
|
name: "Mock: プリザンターUsers/Depts(sample代替・一時利用)",
|
|
nodes: [
|
|
{
|
|
parameters: {
|
|
httpMethod: "POST",
|
|
path: "org-sync-mock-pleasanter-data",
|
|
authentication: "headerAuth",
|
|
responseMode: "responseNode",
|
|
options: {},
|
|
},
|
|
id: "trigger_mock",
|
|
name: "Webhook起動",
|
|
type: "n8n-nodes-base.webhook",
|
|
typeVersion: 2,
|
|
position: [-200, 300],
|
|
webhookId: "org-sync-mock-pleasanter-data-wh",
|
|
credentials: {
|
|
httpHeaderAuth: { id: "cr3uqCC8mW9OJfMi", name: "org-sync Mock Pleasanter Data Auth" },
|
|
},
|
|
},
|
|
{
|
|
parameters: { jsCode },
|
|
id: "code_mock_data",
|
|
name: "モックデータ返却",
|
|
type: "n8n-nodes-base.code",
|
|
typeVersion: 2,
|
|
position: [20, 300],
|
|
},
|
|
{
|
|
parameters: { respondWith: "json", responseBody: "={{ $json }}", options: {} },
|
|
id: "respond_mock",
|
|
name: "完了応答",
|
|
type: "n8n-nodes-base.respondToWebhook",
|
|
typeVersion: 1.1,
|
|
position: [240, 300],
|
|
},
|
|
],
|
|
connections: {
|
|
Webhook起動: { main: [[{ node: "モックデータ返却", type: "main", index: 0 }]] },
|
|
モックデータ返却: { main: [[{ node: "完了応答", type: "main", index: 0 }]] },
|
|
},
|
|
settings: { executionOrder: "v1" },
|
|
};
|
|
|
|
fs.writeFileSync(path.join(__dirname, "_tmp-mock-workflow-payload.json"), JSON.stringify(workflow), "utf8");
|
|
console.log("payload size:", Buffer.byteLength(JSON.stringify(workflow)), "bytes");
|