@squadbase/vite-server 0.1.3-dev.10 → 0.1.3-dev.11
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.
- package/dist/cli/index.js +356 -82
- package/dist/connectors/backlog-api-key.d.ts +5 -0
- package/dist/connectors/backlog-api-key.js +592 -0
- package/dist/index.js +354 -80
- package/dist/main.js +354 -80
- package/dist/vite-plugin.js +354 -80
- package/package.json +5 -1
package/dist/vite-plugin.js
CHANGED
|
@@ -18892,14 +18892,14 @@ var init_NormalizedSchema = __esm({
|
|
|
18892
18892
|
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
|
18893
18893
|
}
|
|
18894
18894
|
const struct = this.getSchema();
|
|
18895
|
-
const
|
|
18895
|
+
const z78 = struct[4].length;
|
|
18896
18896
|
let it = struct[anno.it];
|
|
18897
|
-
if (it &&
|
|
18897
|
+
if (it && z78 === it.length) {
|
|
18898
18898
|
yield* it;
|
|
18899
18899
|
return;
|
|
18900
18900
|
}
|
|
18901
|
-
it = Array(
|
|
18902
|
-
for (let i6 = 0; i6 <
|
|
18901
|
+
it = Array(z78);
|
|
18902
|
+
for (let i6 = 0; i6 < z78; ++i6) {
|
|
18903
18903
|
const k6 = struct[4][i6];
|
|
18904
18904
|
const v7 = member([struct[5][i6], 0], k6);
|
|
18905
18905
|
yield it[i6] = [k6, v7];
|
|
@@ -19575,12 +19575,12 @@ var init_split_header = __esm({
|
|
|
19575
19575
|
"../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"() {
|
|
19576
19576
|
"use strict";
|
|
19577
19577
|
splitHeader = (value) => {
|
|
19578
|
-
const
|
|
19578
|
+
const z78 = value.length;
|
|
19579
19579
|
const values = [];
|
|
19580
19580
|
let withinQuotes = false;
|
|
19581
19581
|
let prevChar = void 0;
|
|
19582
19582
|
let anchor = 0;
|
|
19583
|
-
for (let i6 = 0; i6 <
|
|
19583
|
+
for (let i6 = 0; i6 < z78; ++i6) {
|
|
19584
19584
|
const char = value[i6];
|
|
19585
19585
|
switch (char) {
|
|
19586
19586
|
case `"`:
|
|
@@ -19601,12 +19601,12 @@ var init_split_header = __esm({
|
|
|
19601
19601
|
values.push(value.slice(anchor));
|
|
19602
19602
|
return values.map((v7) => {
|
|
19603
19603
|
v7 = v7.trim();
|
|
19604
|
-
const
|
|
19605
|
-
if (
|
|
19604
|
+
const z79 = v7.length;
|
|
19605
|
+
if (z79 < 2) {
|
|
19606
19606
|
return v7;
|
|
19607
19607
|
}
|
|
19608
|
-
if (v7[0] === `"` && v7[
|
|
19609
|
-
v7 = v7.slice(1,
|
|
19608
|
+
if (v7[0] === `"` && v7[z79 - 1] === `"`) {
|
|
19609
|
+
v7 = v7.slice(1, z79 - 1);
|
|
19610
19610
|
}
|
|
19611
19611
|
return v7.replace(/\\"/g, '"');
|
|
19612
19612
|
});
|
|
@@ -21004,11 +21004,11 @@ var init_EndpointCache = __esm({
|
|
|
21004
21004
|
}
|
|
21005
21005
|
hash(endpointParams) {
|
|
21006
21006
|
let buffer = "";
|
|
21007
|
-
const { parameters:
|
|
21008
|
-
if (
|
|
21007
|
+
const { parameters: parameters61 } = this;
|
|
21008
|
+
if (parameters61.length === 0) {
|
|
21009
21009
|
return false;
|
|
21010
21010
|
}
|
|
21011
|
-
for (const param of
|
|
21011
|
+
for (const param of parameters61) {
|
|
21012
21012
|
const val = String(endpointParams[param] ?? "");
|
|
21013
21013
|
if (val.includes("|;")) {
|
|
21014
21014
|
return false;
|
|
@@ -21725,15 +21725,15 @@ var init_resolveEndpoint = __esm({
|
|
|
21725
21725
|
init_utils3();
|
|
21726
21726
|
resolveEndpoint = (ruleSetObject, options) => {
|
|
21727
21727
|
const { endpointParams, logger: logger2 } = options;
|
|
21728
|
-
const { parameters:
|
|
21728
|
+
const { parameters: parameters61, rules } = ruleSetObject;
|
|
21729
21729
|
options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
|
|
21730
|
-
const paramsWithDefault = Object.entries(
|
|
21730
|
+
const paramsWithDefault = Object.entries(parameters61).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
|
|
21731
21731
|
if (paramsWithDefault.length > 0) {
|
|
21732
21732
|
for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
|
|
21733
21733
|
endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
|
|
21734
21734
|
}
|
|
21735
21735
|
}
|
|
21736
|
-
const requiredParams = Object.entries(
|
|
21736
|
+
const requiredParams = Object.entries(parameters61).filter(([, v7]) => v7.required).map(([k6]) => k6);
|
|
21737
21737
|
for (const requiredParam of requiredParams) {
|
|
21738
21738
|
if (endpointParams[requiredParam] == null) {
|
|
21739
21739
|
throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
|
|
@@ -27343,8 +27343,8 @@ var init_ProtocolLib = __esm({
|
|
|
27343
27343
|
constructor(queryCompat = false) {
|
|
27344
27344
|
this.queryCompat = queryCompat;
|
|
27345
27345
|
}
|
|
27346
|
-
resolveRestContentType(defaultContentType,
|
|
27347
|
-
const members =
|
|
27346
|
+
resolveRestContentType(defaultContentType, inputSchema75) {
|
|
27347
|
+
const members = inputSchema75.getMemberSchemas();
|
|
27348
27348
|
const httpPayloadMember = Object.values(members).find((m6) => {
|
|
27349
27349
|
return !!m6.getMergedTraits().httpPayload;
|
|
27350
27350
|
});
|
|
@@ -27359,7 +27359,7 @@ var init_ProtocolLib = __esm({
|
|
|
27359
27359
|
} else {
|
|
27360
27360
|
return defaultContentType;
|
|
27361
27361
|
}
|
|
27362
|
-
} else if (!
|
|
27362
|
+
} else if (!inputSchema75.isUnitSchema()) {
|
|
27363
27363
|
const hasBody = Object.values(members).find((m6) => {
|
|
27364
27364
|
const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m6.getMergedTraits();
|
|
27365
27365
|
const noPrefixHeaders = httpPrefixHeaders === void 0;
|
|
@@ -28202,9 +28202,9 @@ var init_AwsRestJsonProtocol = __esm({
|
|
|
28202
28202
|
}
|
|
28203
28203
|
async serializeRequest(operationSchema, input, context) {
|
|
28204
28204
|
const request2 = await super.serializeRequest(operationSchema, input, context);
|
|
28205
|
-
const
|
|
28205
|
+
const inputSchema75 = NormalizedSchema.of(operationSchema.input);
|
|
28206
28206
|
if (!request2.headers["content-type"]) {
|
|
28207
|
-
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(),
|
|
28207
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema75);
|
|
28208
28208
|
if (contentType) {
|
|
28209
28209
|
request2.headers["content-type"] = contentType;
|
|
28210
28210
|
}
|
|
@@ -28216,8 +28216,8 @@ var init_AwsRestJsonProtocol = __esm({
|
|
|
28216
28216
|
}
|
|
28217
28217
|
async deserializeResponse(operationSchema, context, response) {
|
|
28218
28218
|
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
28219
|
-
const
|
|
28220
|
-
for (const [name, member2] of
|
|
28219
|
+
const outputSchema75 = NormalizedSchema.of(operationSchema.output);
|
|
28220
|
+
for (const [name, member2] of outputSchema75.structIterator()) {
|
|
28221
28221
|
if (member2.getMemberTraits().httpPayload && !(name in output)) {
|
|
28222
28222
|
output[name] = null;
|
|
28223
28223
|
}
|
|
@@ -32081,22 +32081,22 @@ var init_loadCognitoIdentity = __esm({
|
|
|
32081
32081
|
});
|
|
32082
32082
|
|
|
32083
32083
|
// ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
|
|
32084
|
-
function fromCognitoIdentity(
|
|
32084
|
+
function fromCognitoIdentity(parameters61) {
|
|
32085
32085
|
return async (awsIdentityProperties) => {
|
|
32086
|
-
|
|
32086
|
+
parameters61.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
|
|
32087
32087
|
const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
32088
|
-
const fromConfigs = (property) =>
|
|
32089
|
-
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(
|
|
32088
|
+
const fromConfigs = (property) => parameters61.clientConfig?.[property] ?? parameters61.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
|
|
32089
|
+
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters61.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters61.logger), SessionToken } = throwOnMissingCredentials(parameters61.logger) } = await (parameters61.client ?? new CognitoIdentityClient2(Object.assign({}, parameters61.clientConfig ?? {}, {
|
|
32090
32090
|
region: fromConfigs("region"),
|
|
32091
32091
|
profile: fromConfigs("profile"),
|
|
32092
32092
|
userAgentAppId: fromConfigs("userAgentAppId")
|
|
32093
32093
|
}))).send(new GetCredentialsForIdentityCommand2({
|
|
32094
|
-
CustomRoleArn:
|
|
32095
|
-
IdentityId:
|
|
32096
|
-
Logins:
|
|
32094
|
+
CustomRoleArn: parameters61.customRoleArn,
|
|
32095
|
+
IdentityId: parameters61.identityId,
|
|
32096
|
+
Logins: parameters61.logins ? await resolveLogins(parameters61.logins) : void 0
|
|
32097
32097
|
}));
|
|
32098
32098
|
return {
|
|
32099
|
-
identityId:
|
|
32099
|
+
identityId: parameters61.identityId,
|
|
32100
32100
|
accessKeyId: AccessKeyId,
|
|
32101
32101
|
secretAccessKey: SecretKey,
|
|
32102
32102
|
sessionToken: SessionToken,
|
|
@@ -44657,11 +44657,11 @@ var require_bignumber = __commonJS({
|
|
|
44657
44657
|
return n6 > 0 || n6 === i6 ? i6 : i6 - 1;
|
|
44658
44658
|
}
|
|
44659
44659
|
function coeffToString(a6) {
|
|
44660
|
-
var s6,
|
|
44660
|
+
var s6, z78, i6 = 1, j6 = a6.length, r6 = a6[0] + "";
|
|
44661
44661
|
for (; i6 < j6; ) {
|
|
44662
44662
|
s6 = a6[i6++] + "";
|
|
44663
|
-
|
|
44664
|
-
for (;
|
|
44663
|
+
z78 = LOG_BASE - s6.length;
|
|
44664
|
+
for (; z78--; s6 = "0" + s6) ;
|
|
44665
44665
|
r6 += s6;
|
|
44666
44666
|
}
|
|
44667
44667
|
for (j6 = r6.length; r6.charCodeAt(--j6) === 48; ) ;
|
|
@@ -44694,15 +44694,15 @@ var require_bignumber = __commonJS({
|
|
|
44694
44694
|
function toExponential(str, e6) {
|
|
44695
44695
|
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e6 < 0 ? "e" : "e+") + e6;
|
|
44696
44696
|
}
|
|
44697
|
-
function toFixedPoint(str, e6,
|
|
44697
|
+
function toFixedPoint(str, e6, z78) {
|
|
44698
44698
|
var len, zs;
|
|
44699
44699
|
if (e6 < 0) {
|
|
44700
|
-
for (zs =
|
|
44700
|
+
for (zs = z78 + "."; ++e6; zs += z78) ;
|
|
44701
44701
|
str = zs + str;
|
|
44702
44702
|
} else {
|
|
44703
44703
|
len = str.length;
|
|
44704
44704
|
if (++e6 > len) {
|
|
44705
|
-
for (zs =
|
|
44705
|
+
for (zs = z78, e6 -= len; --e6; zs += z78) ;
|
|
44706
44706
|
str += zs;
|
|
44707
44707
|
} else if (e6 < len) {
|
|
44708
44708
|
str = str.slice(0, e6) + "." + str.slice(e6);
|
|
@@ -85352,6 +85352,279 @@ export default async function handler(c: Context) {
|
|
|
85352
85352
|
tools: tools59
|
|
85353
85353
|
});
|
|
85354
85354
|
|
|
85355
|
+
// ../connectors/src/connectors/backlog/setup.ts
|
|
85356
|
+
var backlogOnboarding = new ConnectorOnboarding({
|
|
85357
|
+
dataOverviewInstructions: {
|
|
85358
|
+
en: `1. Call backlog-api-key_request with GET space to verify the connection and get space information
|
|
85359
|
+
2. Call backlog-api-key_request with GET projects to list all accessible projects
|
|
85360
|
+
3. For key projects, call backlog-api-key_request with GET issues?projectId[]={projectId}&count=5&order=desc to retrieve recent issues
|
|
85361
|
+
4. Call backlog-api-key_request with GET projects/{projectIdOrKey}/statuses to understand the workflow statuses`,
|
|
85362
|
+
ja: `1. backlog-api-key_request \u3067 GET space \u3092\u547C\u3073\u51FA\u3057\u3001\u63A5\u7D9A\u78BA\u8A8D\u3068\u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u3092\u53D6\u5F97
|
|
85363
|
+
2. backlog-api-key_request \u3067 GET projects \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
85364
|
+
3. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066 backlog-api-key_request \u3067 GET issues?projectId[]={projectId}&count=5&order=desc \u3092\u547C\u3073\u51FA\u3057\u3001\u6700\u8FD1\u306E\u8AB2\u984C\u3092\u53D6\u5F97
|
|
85365
|
+
4. backlog-api-key_request \u3067 GET projects/{projectIdOrKey}/statuses \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u78BA\u8A8D`
|
|
85366
|
+
}
|
|
85367
|
+
});
|
|
85368
|
+
|
|
85369
|
+
// ../connectors/src/connectors/backlog/parameters.ts
|
|
85370
|
+
var parameters60 = {
|
|
85371
|
+
spaceUrl: new ParameterDefinition({
|
|
85372
|
+
slug: "space-url",
|
|
85373
|
+
name: "Backlog Space URL",
|
|
85374
|
+
description: "Your Backlog space URL \u2014 just the base address, without any trailing path. For example: https://your-space.backlog.com or https://your-space.backlog.jp",
|
|
85375
|
+
envVarBaseKey: "BACKLOG_SPACE_URL",
|
|
85376
|
+
type: "text",
|
|
85377
|
+
secret: false,
|
|
85378
|
+
required: true
|
|
85379
|
+
}),
|
|
85380
|
+
apiKey: new ParameterDefinition({
|
|
85381
|
+
slug: "api-key",
|
|
85382
|
+
name: "API Key",
|
|
85383
|
+
description: "Your Backlog API key. You can generate one at: Your Space > Personal Settings > API (https://your-space.backlog.com/EditApiSettings.action).",
|
|
85384
|
+
envVarBaseKey: "BACKLOG_API_KEY",
|
|
85385
|
+
type: "text",
|
|
85386
|
+
secret: true,
|
|
85387
|
+
required: true
|
|
85388
|
+
})
|
|
85389
|
+
};
|
|
85390
|
+
|
|
85391
|
+
// ../connectors/src/connectors/backlog/tools/request.ts
|
|
85392
|
+
import { z as z76 } from "zod";
|
|
85393
|
+
var REQUEST_TIMEOUT_MS59 = 6e4;
|
|
85394
|
+
var inputSchema74 = z76.object({
|
|
85395
|
+
toolUseIntent: z76.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
|
|
85396
|
+
connectionId: z76.string().describe("ID of the Backlog connection to use"),
|
|
85397
|
+
method: z76.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method. Use GET to read resources, POST to create, PATCH/PUT to update, DELETE to remove."),
|
|
85398
|
+
path: z76.string().describe("API path relative to /api/v2/ (e.g., 'space', 'projects', 'issues?projectId[]=12345'). Query parameters can be appended. The apiKey query parameter is added automatically \u2014 do NOT include it."),
|
|
85399
|
+
body: z76.record(z76.string(), z76.unknown()).optional().describe("Request body as JSON object. Required for POST, PUT, and PATCH requests (e.g., issue creation, comment addition).")
|
|
85400
|
+
});
|
|
85401
|
+
var outputSchema74 = z76.discriminatedUnion("success", [
|
|
85402
|
+
z76.object({
|
|
85403
|
+
success: z76.literal(true),
|
|
85404
|
+
status: z76.number(),
|
|
85405
|
+
data: z76.union([z76.record(z76.string(), z76.unknown()), z76.array(z76.unknown())])
|
|
85406
|
+
}),
|
|
85407
|
+
z76.object({
|
|
85408
|
+
success: z76.literal(false),
|
|
85409
|
+
error: z76.string()
|
|
85410
|
+
})
|
|
85411
|
+
]);
|
|
85412
|
+
var requestTool45 = new ConnectorTool({
|
|
85413
|
+
name: "request",
|
|
85414
|
+
description: `Send authenticated requests to the Backlog REST API (v2).
|
|
85415
|
+
Authentication is handled automatically by appending the apiKey query parameter to every request.
|
|
85416
|
+
Use this tool for all Backlog operations: listing projects, searching and creating issues, managing wikis, retrieving users, and more.
|
|
85417
|
+
The base URL and API key are configured per connection \u2014 only specify the API path relative to /api/v2/.
|
|
85418
|
+
Do NOT include the apiKey parameter yourself; it is injected automatically.`,
|
|
85419
|
+
inputSchema: inputSchema74,
|
|
85420
|
+
outputSchema: outputSchema74,
|
|
85421
|
+
async execute({ connectionId, method, path: path4, body }, connections) {
|
|
85422
|
+
const connection = connections.find((c6) => c6.id === connectionId);
|
|
85423
|
+
if (!connection) {
|
|
85424
|
+
return { success: false, error: `Connection ${connectionId} not found` };
|
|
85425
|
+
}
|
|
85426
|
+
console.log(`[connector-request] backlog-api-key/${connection.name}: ${method} ${path4}`);
|
|
85427
|
+
try {
|
|
85428
|
+
const spaceUrl = parameters60.spaceUrl.getValue(connection);
|
|
85429
|
+
const apiKey = parameters60.apiKey.getValue(connection);
|
|
85430
|
+
const separator = path4.includes("?") ? "&" : "?";
|
|
85431
|
+
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${path4}${separator}apiKey=${apiKey}`;
|
|
85432
|
+
const controller = new AbortController();
|
|
85433
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS59);
|
|
85434
|
+
try {
|
|
85435
|
+
const headers = {
|
|
85436
|
+
Accept: "application/json"
|
|
85437
|
+
};
|
|
85438
|
+
if (body) {
|
|
85439
|
+
headers["Content-Type"] = "application/json";
|
|
85440
|
+
}
|
|
85441
|
+
const response = await fetch(url, {
|
|
85442
|
+
method,
|
|
85443
|
+
headers,
|
|
85444
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
85445
|
+
signal: controller.signal
|
|
85446
|
+
});
|
|
85447
|
+
if (response.status === 204) {
|
|
85448
|
+
return { success: true, status: 204, data: {} };
|
|
85449
|
+
}
|
|
85450
|
+
const data = await response.json();
|
|
85451
|
+
if (!response.ok) {
|
|
85452
|
+
const errData = data;
|
|
85453
|
+
const errors2 = errData?.errors;
|
|
85454
|
+
const errorMessage = Array.isArray(errors2) ? errors2.map((e6) => e6.message).join("; ") : errData?.message ?? `HTTP ${response.status} ${response.statusText}`;
|
|
85455
|
+
return { success: false, error: errorMessage };
|
|
85456
|
+
}
|
|
85457
|
+
return { success: true, status: response.status, data };
|
|
85458
|
+
} finally {
|
|
85459
|
+
clearTimeout(timeout);
|
|
85460
|
+
}
|
|
85461
|
+
} catch (err) {
|
|
85462
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
85463
|
+
return { success: false, error: msg };
|
|
85464
|
+
}
|
|
85465
|
+
}
|
|
85466
|
+
});
|
|
85467
|
+
|
|
85468
|
+
// ../connectors/src/connectors/backlog/index.ts
|
|
85469
|
+
var tools60 = { request: requestTool45 };
|
|
85470
|
+
var backlogConnector = new ConnectorPlugin({
|
|
85471
|
+
slug: "backlog",
|
|
85472
|
+
authType: AUTH_TYPES.API_KEY,
|
|
85473
|
+
name: "Backlog",
|
|
85474
|
+
description: "Connect to Nulab Backlog for project management, issue tracking, and wiki data retrieval using API key authentication.",
|
|
85475
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6KcVBGf3mUHnuCOQgQMvtT/e8558c7990e40e3be46948e9476190fb/backlog-favicon.svg",
|
|
85476
|
+
parameters: parameters60,
|
|
85477
|
+
releaseFlag: { dev1: true, dev2: true, prod: false },
|
|
85478
|
+
onboarding: backlogOnboarding,
|
|
85479
|
+
systemPrompt: {
|
|
85480
|
+
en: `### Tools
|
|
85481
|
+
|
|
85482
|
+
- \`backlog-api-key_request\`: The only way to call the Backlog REST API (v2). Use it to list projects, search issues, get issue details, create/update issues, manage wikis, and retrieve users. Authentication (API key as query parameter) and space URL are configured automatically.
|
|
85483
|
+
|
|
85484
|
+
### Business Logic
|
|
85485
|
+
|
|
85486
|
+
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
|
|
85487
|
+
|
|
85488
|
+
#### Example
|
|
85489
|
+
|
|
85490
|
+
\`\`\`ts
|
|
85491
|
+
import { connection } from "@squadbase/vite-server/connectors/backlog-api-key";
|
|
85492
|
+
|
|
85493
|
+
const backlog = connection("<connectionId>");
|
|
85494
|
+
|
|
85495
|
+
// List projects
|
|
85496
|
+
const res = await backlog.request("/api/v2/projects");
|
|
85497
|
+
const projects = await res.json();
|
|
85498
|
+
|
|
85499
|
+
// Get issues for a project
|
|
85500
|
+
const issuesRes = await backlog.request("/api/v2/issues?projectId[]=12345&count=20&sort=updated&order=desc");
|
|
85501
|
+
const issues = await issuesRes.json();
|
|
85502
|
+
|
|
85503
|
+
// Create an issue
|
|
85504
|
+
await backlog.request("/api/v2/issues", {
|
|
85505
|
+
method: "POST",
|
|
85506
|
+
body: JSON.stringify({
|
|
85507
|
+
projectId: 12345,
|
|
85508
|
+
summary: "New issue title",
|
|
85509
|
+
issueTypeId: 67890,
|
|
85510
|
+
priorityId: 3,
|
|
85511
|
+
}),
|
|
85512
|
+
});
|
|
85513
|
+
\`\`\`
|
|
85514
|
+
|
|
85515
|
+
### Backlog REST API v2 Reference
|
|
85516
|
+
|
|
85517
|
+
#### Space
|
|
85518
|
+
- GET space \u2014 Get space information
|
|
85519
|
+
- GET space/activities \u2014 Get recent activities in the space
|
|
85520
|
+
|
|
85521
|
+
#### Projects
|
|
85522
|
+
- GET projects \u2014 List all projects (query params: archived, all)
|
|
85523
|
+
- GET projects/{projectIdOrKey} \u2014 Get project details
|
|
85524
|
+
- GET projects/{projectIdOrKey}/statuses \u2014 List issue statuses
|
|
85525
|
+
- GET projects/{projectIdOrKey}/issueTypes \u2014 List issue types
|
|
85526
|
+
- GET projects/{projectIdOrKey}/categories \u2014 List issue categories
|
|
85527
|
+
|
|
85528
|
+
#### Issues
|
|
85529
|
+
- GET issues \u2014 Search issues (query params: projectId[], statusId[], assigneeId[], sort, order, count, offset, keyword)
|
|
85530
|
+
- GET issues/{issueIdOrKey} \u2014 Get issue details
|
|
85531
|
+
- GET issues/count \u2014 Get issue count
|
|
85532
|
+
- POST issues \u2014 Create an issue (body: projectId, summary, issueTypeId, priorityId, and optional fields)
|
|
85533
|
+
- PATCH issues/{issueIdOrKey} \u2014 Update an issue
|
|
85534
|
+
- DELETE issues/{issueIdOrKey} \u2014 Delete an issue
|
|
85535
|
+
- GET issues/{issueIdOrKey}/comments \u2014 List comments
|
|
85536
|
+
- POST issues/{issueIdOrKey}/comments \u2014 Add a comment (body: { content: "comment text" })
|
|
85537
|
+
|
|
85538
|
+
#### Wiki
|
|
85539
|
+
- GET wikis \u2014 List wiki pages (query params: projectIdOrKey, keyword)
|
|
85540
|
+
- GET wikis/{wikiId} \u2014 Get wiki page details
|
|
85541
|
+
- POST wikis \u2014 Create a wiki page (body: projectId, name, content)
|
|
85542
|
+
- PATCH wikis/{wikiId} \u2014 Update a wiki page
|
|
85543
|
+
|
|
85544
|
+
#### Users
|
|
85545
|
+
- GET users \u2014 List users in the space
|
|
85546
|
+
- GET users/myself \u2014 Get authenticated user info
|
|
85547
|
+
|
|
85548
|
+
#### Pagination
|
|
85549
|
+
- Use count (max 100, default 20) and offset parameters for pagination
|
|
85550
|
+
- sort: "created", "updated", "issueType", "category", "priority", etc.
|
|
85551
|
+
- order: "asc" or "desc"`,
|
|
85552
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
85553
|
+
|
|
85554
|
+
- \`backlog-api-key_request\`: Backlog REST API\uFF08v2\uFF09\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u8AB2\u984C\u306E\u691C\u7D22\u3001\u8AB2\u984C\u8A73\u7D30\u306E\u53D6\u5F97\u3001\u8AB2\u984C\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u3001Wiki\u7BA1\u7406\u3001\u30E6\u30FC\u30B6\u30FC\u53D6\u5F97\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30AD\u30FC\u3092\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3068\u3057\u3066\u4ED8\u4E0E\uFF09\u3068\u30B9\u30DA\u30FC\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
85555
|
+
|
|
85556
|
+
### Business Logic
|
|
85557
|
+
|
|
85558
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
85559
|
+
|
|
85560
|
+
#### Example
|
|
85561
|
+
|
|
85562
|
+
\`\`\`ts
|
|
85563
|
+
import { connection } from "@squadbase/vite-server/connectors/backlog-api-key";
|
|
85564
|
+
|
|
85565
|
+
const backlog = connection("<connectionId>");
|
|
85566
|
+
|
|
85567
|
+
// \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
85568
|
+
const res = await backlog.request("/api/v2/projects");
|
|
85569
|
+
const projects = await res.json();
|
|
85570
|
+
|
|
85571
|
+
// \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u8AB2\u984C\u3092\u53D6\u5F97
|
|
85572
|
+
const issuesRes = await backlog.request("/api/v2/issues?projectId[]=12345&count=20&sort=updated&order=desc");
|
|
85573
|
+
const issues = await issuesRes.json();
|
|
85574
|
+
|
|
85575
|
+
// \u8AB2\u984C\u3092\u4F5C\u6210
|
|
85576
|
+
await backlog.request("/api/v2/issues", {
|
|
85577
|
+
method: "POST",
|
|
85578
|
+
body: JSON.stringify({
|
|
85579
|
+
projectId: 12345,
|
|
85580
|
+
summary: "\u65B0\u3057\u3044\u8AB2\u984C",
|
|
85581
|
+
issueTypeId: 67890,
|
|
85582
|
+
priorityId: 3,
|
|
85583
|
+
}),
|
|
85584
|
+
});
|
|
85585
|
+
\`\`\`
|
|
85586
|
+
|
|
85587
|
+
### Backlog REST API v2 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
85588
|
+
|
|
85589
|
+
#### \u30B9\u30DA\u30FC\u30B9
|
|
85590
|
+
- GET space \u2014 \u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u306E\u53D6\u5F97
|
|
85591
|
+
- GET space/activities \u2014 \u30B9\u30DA\u30FC\u30B9\u306E\u6700\u8FD1\u306E\u6D3B\u52D5\u3092\u53D6\u5F97
|
|
85592
|
+
|
|
85593
|
+
#### \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8
|
|
85594
|
+
- GET projects \u2014 \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\uFF08\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: archived, all\uFF09
|
|
85595
|
+
- GET projects/{projectIdOrKey} \u2014 \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u8A73\u7D30\u306E\u53D6\u5F97
|
|
85596
|
+
- GET projects/{projectIdOrKey}/statuses \u2014 \u8AB2\u984C\u30B9\u30C6\u30FC\u30BF\u30B9\u4E00\u89A7
|
|
85597
|
+
- GET projects/{projectIdOrKey}/issueTypes \u2014 \u8AB2\u984C\u7A2E\u5225\u4E00\u89A7
|
|
85598
|
+
- GET projects/{projectIdOrKey}/categories \u2014 \u8AB2\u984C\u30AB\u30C6\u30B4\u30EA\u4E00\u89A7
|
|
85599
|
+
|
|
85600
|
+
#### \u8AB2\u984C
|
|
85601
|
+
- GET issues \u2014 \u8AB2\u984C\u306E\u691C\u7D22\uFF08\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: projectId[], statusId[], assigneeId[], sort, order, count, offset, keyword\uFF09
|
|
85602
|
+
- GET issues/{issueIdOrKey} \u2014 \u8AB2\u984C\u8A73\u7D30\u306E\u53D6\u5F97
|
|
85603
|
+
- GET issues/count \u2014 \u8AB2\u984C\u6570\u306E\u53D6\u5F97
|
|
85604
|
+
- POST issues \u2014 \u8AB2\u984C\u306E\u4F5C\u6210\uFF08body: projectId, summary, issueTypeId, priorityId, \u305D\u306E\u4ED6\u30AA\u30D7\u30B7\u30E7\u30F3\u30D5\u30A3\u30FC\u30EB\u30C9\uFF09
|
|
85605
|
+
- PATCH issues/{issueIdOrKey} \u2014 \u8AB2\u984C\u306E\u66F4\u65B0
|
|
85606
|
+
- DELETE issues/{issueIdOrKey} \u2014 \u8AB2\u984C\u306E\u524A\u9664
|
|
85607
|
+
- GET issues/{issueIdOrKey}/comments \u2014 \u30B3\u30E1\u30F3\u30C8\u4E00\u89A7
|
|
85608
|
+
- POST issues/{issueIdOrKey}/comments \u2014 \u30B3\u30E1\u30F3\u30C8\u306E\u8FFD\u52A0\uFF08body: { content: "\u30B3\u30E1\u30F3\u30C8\u5185\u5BB9" }\uFF09
|
|
85609
|
+
|
|
85610
|
+
#### Wiki
|
|
85611
|
+
- GET wikis \u2014 Wiki\u30DA\u30FC\u30B8\u4E00\u89A7\u306E\u53D6\u5F97\uFF08\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: projectIdOrKey, keyword\uFF09
|
|
85612
|
+
- GET wikis/{wikiId} \u2014 Wiki\u30DA\u30FC\u30B8\u8A73\u7D30\u306E\u53D6\u5F97
|
|
85613
|
+
- POST wikis \u2014 Wiki\u30DA\u30FC\u30B8\u306E\u4F5C\u6210\uFF08body: projectId, name, content\uFF09
|
|
85614
|
+
- PATCH wikis/{wikiId} \u2014 Wiki\u30DA\u30FC\u30B8\u306E\u66F4\u65B0
|
|
85615
|
+
|
|
85616
|
+
#### \u30E6\u30FC\u30B6\u30FC
|
|
85617
|
+
- GET users \u2014 \u30B9\u30DA\u30FC\u30B9\u5185\u306E\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
|
|
85618
|
+
- GET users/myself \u2014 \u8A8D\u8A3C\u6E08\u307F\u30E6\u30FC\u30B6\u30FC\u60C5\u5831\u306E\u53D6\u5F97
|
|
85619
|
+
|
|
85620
|
+
#### \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3
|
|
85621
|
+
- count\uFF08\u6700\u5927100\u3001\u30C7\u30D5\u30A9\u30EB\u30C820\uFF09\u3068 offset \u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3
|
|
85622
|
+
- sort: "created", "updated", "issueType", "category", "priority" \u7B49
|
|
85623
|
+
- order: "asc" \u307E\u305F\u306F "desc"`
|
|
85624
|
+
},
|
|
85625
|
+
tools: tools60
|
|
85626
|
+
});
|
|
85627
|
+
|
|
85355
85628
|
// ../connectors/src/connectors/registry.ts
|
|
85356
85629
|
var plugins = {
|
|
85357
85630
|
snowflake: snowflakeConnector,
|
|
@@ -85412,7 +85685,8 @@ var plugins = {
|
|
|
85412
85685
|
intercom: intercomConnector,
|
|
85413
85686
|
intercomOauth: intercomOauthConnector,
|
|
85414
85687
|
mixpanel: mixpanelConnector,
|
|
85415
|
-
grafana: grafanaConnector
|
|
85688
|
+
grafana: grafanaConnector,
|
|
85689
|
+
backlog: backlogConnector
|
|
85416
85690
|
};
|
|
85417
85691
|
var connectors = {
|
|
85418
85692
|
...plugins,
|
|
@@ -85613,62 +85887,62 @@ function resolveParams2(entry, connectionId, plugin) {
|
|
|
85613
85887
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
85614
85888
|
|
|
85615
85889
|
// src/types/server-logic.ts
|
|
85616
|
-
import { z as
|
|
85617
|
-
var parameterMetaSchema =
|
|
85618
|
-
name:
|
|
85619
|
-
type:
|
|
85620
|
-
description:
|
|
85621
|
-
required:
|
|
85622
|
-
default:
|
|
85623
|
-
});
|
|
85624
|
-
var serverLogicCacheConfigSchema =
|
|
85625
|
-
ttl:
|
|
85626
|
-
staleWhileRevalidate:
|
|
85627
|
-
});
|
|
85628
|
-
var serverLogicSchemaObjectSchema =
|
|
85629
|
-
() =>
|
|
85630
|
-
type:
|
|
85631
|
-
format:
|
|
85632
|
-
description:
|
|
85633
|
-
nullable:
|
|
85634
|
-
enum:
|
|
85890
|
+
import { z as z77 } from "zod";
|
|
85891
|
+
var parameterMetaSchema = z77.object({
|
|
85892
|
+
name: z77.string(),
|
|
85893
|
+
type: z77.enum(["string", "number", "boolean"]),
|
|
85894
|
+
description: z77.string(),
|
|
85895
|
+
required: z77.boolean().optional(),
|
|
85896
|
+
default: z77.union([z77.string(), z77.number(), z77.boolean()]).optional()
|
|
85897
|
+
});
|
|
85898
|
+
var serverLogicCacheConfigSchema = z77.object({
|
|
85899
|
+
ttl: z77.number(),
|
|
85900
|
+
staleWhileRevalidate: z77.boolean().optional()
|
|
85901
|
+
});
|
|
85902
|
+
var serverLogicSchemaObjectSchema = z77.lazy(
|
|
85903
|
+
() => z77.object({
|
|
85904
|
+
type: z77.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
85905
|
+
format: z77.string().optional(),
|
|
85906
|
+
description: z77.string().optional(),
|
|
85907
|
+
nullable: z77.boolean().optional(),
|
|
85908
|
+
enum: z77.array(z77.union([z77.string(), z77.number(), z77.boolean(), z77.null()])).optional(),
|
|
85635
85909
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
85636
|
-
properties:
|
|
85637
|
-
required:
|
|
85638
|
-
additionalProperties:
|
|
85639
|
-
minimum:
|
|
85640
|
-
maximum:
|
|
85641
|
-
minLength:
|
|
85642
|
-
maxLength:
|
|
85643
|
-
pattern:
|
|
85910
|
+
properties: z77.record(z77.string(), serverLogicSchemaObjectSchema).optional(),
|
|
85911
|
+
required: z77.array(z77.string()).optional(),
|
|
85912
|
+
additionalProperties: z77.union([z77.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
85913
|
+
minimum: z77.number().optional(),
|
|
85914
|
+
maximum: z77.number().optional(),
|
|
85915
|
+
minLength: z77.number().optional(),
|
|
85916
|
+
maxLength: z77.number().optional(),
|
|
85917
|
+
pattern: z77.string().optional()
|
|
85644
85918
|
})
|
|
85645
85919
|
);
|
|
85646
|
-
var serverLogicMediaTypeSchema =
|
|
85920
|
+
var serverLogicMediaTypeSchema = z77.object({
|
|
85647
85921
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
85648
|
-
example:
|
|
85922
|
+
example: z77.unknown().optional()
|
|
85649
85923
|
});
|
|
85650
|
-
var serverLogicResponseSchema =
|
|
85651
|
-
description:
|
|
85652
|
-
content:
|
|
85924
|
+
var serverLogicResponseSchema = z77.object({
|
|
85925
|
+
description: z77.string().optional(),
|
|
85926
|
+
content: z77.record(z77.string(), serverLogicMediaTypeSchema).optional()
|
|
85653
85927
|
});
|
|
85654
85928
|
var jsonBaseFields = {
|
|
85655
|
-
description:
|
|
85656
|
-
parameters:
|
|
85929
|
+
description: z77.string(),
|
|
85930
|
+
parameters: z77.array(parameterMetaSchema).optional(),
|
|
85657
85931
|
response: serverLogicResponseSchema.optional(),
|
|
85658
85932
|
cache: serverLogicCacheConfigSchema.optional()
|
|
85659
85933
|
};
|
|
85660
|
-
var jsonSqlServerLogicSchema =
|
|
85934
|
+
var jsonSqlServerLogicSchema = z77.object({
|
|
85661
85935
|
...jsonBaseFields,
|
|
85662
|
-
type:
|
|
85663
|
-
query:
|
|
85664
|
-
connectionId:
|
|
85936
|
+
type: z77.literal("sql").optional(),
|
|
85937
|
+
query: z77.string(),
|
|
85938
|
+
connectionId: z77.string()
|
|
85665
85939
|
});
|
|
85666
|
-
var jsonTypeScriptServerLogicSchema =
|
|
85940
|
+
var jsonTypeScriptServerLogicSchema = z77.object({
|
|
85667
85941
|
...jsonBaseFields,
|
|
85668
|
-
type:
|
|
85669
|
-
handlerPath:
|
|
85942
|
+
type: z77.literal("typescript"),
|
|
85943
|
+
handlerPath: z77.string()
|
|
85670
85944
|
});
|
|
85671
|
-
var anyJsonServerLogicSchema =
|
|
85945
|
+
var anyJsonServerLogicSchema = z77.union([
|
|
85672
85946
|
jsonTypeScriptServerLogicSchema,
|
|
85673
85947
|
jsonSqlServerLogicSchema
|
|
85674
85948
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squadbase/vite-server",
|
|
3
|
-
"version": "0.1.3-dev.
|
|
3
|
+
"version": "0.1.3-dev.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -131,6 +131,10 @@
|
|
|
131
131
|
"import": "./dist/connectors/jira-api-key.js",
|
|
132
132
|
"types": "./dist/connectors/jira-api-key.d.ts"
|
|
133
133
|
},
|
|
134
|
+
"./connectors/backlog-api-key": {
|
|
135
|
+
"import": "./dist/connectors/backlog-api-key.js",
|
|
136
|
+
"types": "./dist/connectors/backlog-api-key.d.ts"
|
|
137
|
+
},
|
|
134
138
|
"./connectors/asana": {
|
|
135
139
|
"import": "./dist/connectors/asana.js",
|
|
136
140
|
"types": "./dist/connectors/asana.d.ts"
|