@ubiquity-os/plugin-sdk 3.8.0 → 3.8.4
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/README.md +109 -34
- package/dist/configuration.d.mts +12 -21
- package/dist/configuration.d.ts +12 -21
- package/dist/configuration.js +63 -2873
- package/dist/configuration.mjs +53 -2873
- package/dist/{context-zLHgu52i.d.ts → context-BbEmsEct.d.ts} +0 -29
- package/dist/{context-Dwl3aRX-.d.mts → context-sqbr2o6i.d.mts} +0 -29
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +226 -3114
- package/dist/index.mjs +218 -3106
- package/dist/llm.d.mts +44 -7
- package/dist/llm.d.ts +44 -7
- package/dist/llm.js +41 -132
- package/dist/llm.mjs +41 -132
- package/dist/octokit.d.mts +2 -2
- package/dist/octokit.d.ts +2 -2
- package/dist/octokit.js +2 -164
- package/dist/octokit.mjs +1 -163
- package/dist/signature.d.mts +3 -1
- package/dist/signature.d.ts +3 -1
- package/dist/signature.js +6 -3
- package/dist/signature.mjs +6 -3
- package/package.json +40 -43
package/dist/octokit.js
CHANGED
|
@@ -24,169 +24,7 @@ __export(octokit_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(octokit_exports);
|
|
26
26
|
var import_core = require("@octokit/core");
|
|
27
|
-
|
|
28
|
-
// ../../node_modules/@octokit/plugin-paginate-graphql/dist-bundle/index.js
|
|
29
|
-
var generateMessage = (path, cursorValue) => `The cursor at "${path.join(
|
|
30
|
-
","
|
|
31
|
-
)}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
|
|
32
|
-
var MissingCursorChange = class extends Error {
|
|
33
|
-
constructor(pageInfo, cursorValue) {
|
|
34
|
-
super(generateMessage(pageInfo.pathInQuery, cursorValue));
|
|
35
|
-
this.pageInfo = pageInfo;
|
|
36
|
-
this.cursorValue = cursorValue;
|
|
37
|
-
if (Error.captureStackTrace) {
|
|
38
|
-
Error.captureStackTrace(this, this.constructor);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
name = "MissingCursorChangeError";
|
|
42
|
-
};
|
|
43
|
-
var MissingPageInfo = class extends Error {
|
|
44
|
-
constructor(response) {
|
|
45
|
-
super(
|
|
46
|
-
`No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: ${JSON.stringify(
|
|
47
|
-
response,
|
|
48
|
-
null,
|
|
49
|
-
2
|
|
50
|
-
)}`
|
|
51
|
-
);
|
|
52
|
-
this.response = response;
|
|
53
|
-
if (Error.captureStackTrace) {
|
|
54
|
-
Error.captureStackTrace(this, this.constructor);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
name = "MissingPageInfo";
|
|
58
|
-
};
|
|
59
|
-
var isObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
60
|
-
function findPaginatedResourcePath(responseData) {
|
|
61
|
-
const paginatedResourcePath = deepFindPathToProperty(
|
|
62
|
-
responseData,
|
|
63
|
-
"pageInfo"
|
|
64
|
-
);
|
|
65
|
-
if (paginatedResourcePath.length === 0) {
|
|
66
|
-
throw new MissingPageInfo(responseData);
|
|
67
|
-
}
|
|
68
|
-
return paginatedResourcePath;
|
|
69
|
-
}
|
|
70
|
-
var deepFindPathToProperty = (object, searchProp, path = []) => {
|
|
71
|
-
for (const key of Object.keys(object)) {
|
|
72
|
-
const currentPath = [...path, key];
|
|
73
|
-
const currentValue = object[key];
|
|
74
|
-
if (isObject(currentValue)) {
|
|
75
|
-
if (currentValue.hasOwnProperty(searchProp)) {
|
|
76
|
-
return currentPath;
|
|
77
|
-
}
|
|
78
|
-
const result = deepFindPathToProperty(
|
|
79
|
-
currentValue,
|
|
80
|
-
searchProp,
|
|
81
|
-
currentPath
|
|
82
|
-
);
|
|
83
|
-
if (result.length > 0) {
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return [];
|
|
89
|
-
};
|
|
90
|
-
var get = (object, path) => {
|
|
91
|
-
return path.reduce((current, nextProperty) => current[nextProperty], object);
|
|
92
|
-
};
|
|
93
|
-
var set = (object, path, mutator) => {
|
|
94
|
-
const lastProperty = path[path.length - 1];
|
|
95
|
-
const parentPath = [...path].slice(0, -1);
|
|
96
|
-
const parent = get(object, parentPath);
|
|
97
|
-
if (typeof mutator === "function") {
|
|
98
|
-
parent[lastProperty] = mutator(parent[lastProperty]);
|
|
99
|
-
} else {
|
|
100
|
-
parent[lastProperty] = mutator;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
var extractPageInfos = (responseData) => {
|
|
104
|
-
const pageInfoPath = findPaginatedResourcePath(responseData);
|
|
105
|
-
return {
|
|
106
|
-
pathInQuery: pageInfoPath,
|
|
107
|
-
pageInfo: get(responseData, [...pageInfoPath, "pageInfo"])
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
var isForwardSearch = (givenPageInfo) => {
|
|
111
|
-
return givenPageInfo.hasOwnProperty("hasNextPage");
|
|
112
|
-
};
|
|
113
|
-
var getCursorFrom = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.endCursor : pageInfo.startCursor;
|
|
114
|
-
var hasAnotherPage = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.hasNextPage : pageInfo.hasPreviousPage;
|
|
115
|
-
var createIterator = (octokit) => {
|
|
116
|
-
return (query, initialParameters = {}) => {
|
|
117
|
-
let nextPageExists = true;
|
|
118
|
-
let parameters = { ...initialParameters };
|
|
119
|
-
return {
|
|
120
|
-
[Symbol.asyncIterator]: () => ({
|
|
121
|
-
async next() {
|
|
122
|
-
if (!nextPageExists) return { done: true, value: {} };
|
|
123
|
-
const response = await octokit.graphql(
|
|
124
|
-
query,
|
|
125
|
-
parameters
|
|
126
|
-
);
|
|
127
|
-
const pageInfoContext = extractPageInfos(response);
|
|
128
|
-
const nextCursorValue = getCursorFrom(pageInfoContext.pageInfo);
|
|
129
|
-
nextPageExists = hasAnotherPage(pageInfoContext.pageInfo);
|
|
130
|
-
if (nextPageExists && nextCursorValue === parameters.cursor) {
|
|
131
|
-
throw new MissingCursorChange(pageInfoContext, nextCursorValue);
|
|
132
|
-
}
|
|
133
|
-
parameters = {
|
|
134
|
-
...parameters,
|
|
135
|
-
cursor: nextCursorValue
|
|
136
|
-
};
|
|
137
|
-
return { done: false, value: response };
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
var mergeResponses = (response1, response2) => {
|
|
144
|
-
if (Object.keys(response1).length === 0) {
|
|
145
|
-
return Object.assign(response1, response2);
|
|
146
|
-
}
|
|
147
|
-
const path = findPaginatedResourcePath(response1);
|
|
148
|
-
const nodesPath = [...path, "nodes"];
|
|
149
|
-
const newNodes = get(response2, nodesPath);
|
|
150
|
-
if (newNodes) {
|
|
151
|
-
set(response1, nodesPath, (values) => {
|
|
152
|
-
return [...values, ...newNodes];
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
const edgesPath = [...path, "edges"];
|
|
156
|
-
const newEdges = get(response2, edgesPath);
|
|
157
|
-
if (newEdges) {
|
|
158
|
-
set(response1, edgesPath, (values) => {
|
|
159
|
-
return [...values, ...newEdges];
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
const pageInfoPath = [...path, "pageInfo"];
|
|
163
|
-
set(response1, pageInfoPath, get(response2, pageInfoPath));
|
|
164
|
-
return response1;
|
|
165
|
-
};
|
|
166
|
-
var createPaginate = (octokit) => {
|
|
167
|
-
const iterator = createIterator(octokit);
|
|
168
|
-
return async (query, initialParameters = {}) => {
|
|
169
|
-
let mergedResponse = {};
|
|
170
|
-
for await (const response of iterator(
|
|
171
|
-
query,
|
|
172
|
-
initialParameters
|
|
173
|
-
)) {
|
|
174
|
-
mergedResponse = mergeResponses(mergedResponse, response);
|
|
175
|
-
}
|
|
176
|
-
return mergedResponse;
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
function paginateGraphQL(octokit) {
|
|
180
|
-
return {
|
|
181
|
-
graphql: Object.assign(octokit.graphql, {
|
|
182
|
-
paginate: Object.assign(createPaginate(octokit), {
|
|
183
|
-
iterator: createIterator(octokit)
|
|
184
|
-
})
|
|
185
|
-
})
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/octokit.ts
|
|
27
|
+
var import_plugin_paginate_graphql = require("@octokit/plugin-paginate-graphql");
|
|
190
28
|
var import_plugin_paginate_rest = require("@octokit/plugin-paginate-rest");
|
|
191
29
|
var import_plugin_rest_endpoint_methods = require("@octokit/plugin-rest-endpoint-methods");
|
|
192
30
|
var import_plugin_retry = require("@octokit/plugin-retry");
|
|
@@ -207,7 +45,7 @@ var defaultOptions = {
|
|
|
207
45
|
}
|
|
208
46
|
}
|
|
209
47
|
};
|
|
210
|
-
var customOctokit = import_core.Octokit.plugin(import_plugin_throttling.throttling, import_plugin_retry.retry, import_plugin_paginate_rest.paginateRest, import_plugin_rest_endpoint_methods.restEndpointMethods, paginateGraphQL).defaults((instanceOptions) => {
|
|
48
|
+
var customOctokit = import_core.Octokit.plugin(import_plugin_throttling.throttling, import_plugin_retry.retry, import_plugin_paginate_rest.paginateRest, import_plugin_rest_endpoint_methods.restEndpointMethods, import_plugin_paginate_graphql.paginateGraphQL).defaults((instanceOptions) => {
|
|
211
49
|
return { ...defaultOptions, ...instanceOptions };
|
|
212
50
|
});
|
|
213
51
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/octokit.mjs
CHANGED
|
@@ -1,168 +1,6 @@
|
|
|
1
1
|
// src/octokit.ts
|
|
2
2
|
import { Octokit } from "@octokit/core";
|
|
3
|
-
|
|
4
|
-
// ../../node_modules/@octokit/plugin-paginate-graphql/dist-bundle/index.js
|
|
5
|
-
var generateMessage = (path, cursorValue) => `The cursor at "${path.join(
|
|
6
|
-
","
|
|
7
|
-
)}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
|
|
8
|
-
var MissingCursorChange = class extends Error {
|
|
9
|
-
constructor(pageInfo, cursorValue) {
|
|
10
|
-
super(generateMessage(pageInfo.pathInQuery, cursorValue));
|
|
11
|
-
this.pageInfo = pageInfo;
|
|
12
|
-
this.cursorValue = cursorValue;
|
|
13
|
-
if (Error.captureStackTrace) {
|
|
14
|
-
Error.captureStackTrace(this, this.constructor);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
name = "MissingCursorChangeError";
|
|
18
|
-
};
|
|
19
|
-
var MissingPageInfo = class extends Error {
|
|
20
|
-
constructor(response) {
|
|
21
|
-
super(
|
|
22
|
-
`No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: ${JSON.stringify(
|
|
23
|
-
response,
|
|
24
|
-
null,
|
|
25
|
-
2
|
|
26
|
-
)}`
|
|
27
|
-
);
|
|
28
|
-
this.response = response;
|
|
29
|
-
if (Error.captureStackTrace) {
|
|
30
|
-
Error.captureStackTrace(this, this.constructor);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
name = "MissingPageInfo";
|
|
34
|
-
};
|
|
35
|
-
var isObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
36
|
-
function findPaginatedResourcePath(responseData) {
|
|
37
|
-
const paginatedResourcePath = deepFindPathToProperty(
|
|
38
|
-
responseData,
|
|
39
|
-
"pageInfo"
|
|
40
|
-
);
|
|
41
|
-
if (paginatedResourcePath.length === 0) {
|
|
42
|
-
throw new MissingPageInfo(responseData);
|
|
43
|
-
}
|
|
44
|
-
return paginatedResourcePath;
|
|
45
|
-
}
|
|
46
|
-
var deepFindPathToProperty = (object, searchProp, path = []) => {
|
|
47
|
-
for (const key of Object.keys(object)) {
|
|
48
|
-
const currentPath = [...path, key];
|
|
49
|
-
const currentValue = object[key];
|
|
50
|
-
if (isObject(currentValue)) {
|
|
51
|
-
if (currentValue.hasOwnProperty(searchProp)) {
|
|
52
|
-
return currentPath;
|
|
53
|
-
}
|
|
54
|
-
const result = deepFindPathToProperty(
|
|
55
|
-
currentValue,
|
|
56
|
-
searchProp,
|
|
57
|
-
currentPath
|
|
58
|
-
);
|
|
59
|
-
if (result.length > 0) {
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return [];
|
|
65
|
-
};
|
|
66
|
-
var get = (object, path) => {
|
|
67
|
-
return path.reduce((current, nextProperty) => current[nextProperty], object);
|
|
68
|
-
};
|
|
69
|
-
var set = (object, path, mutator) => {
|
|
70
|
-
const lastProperty = path[path.length - 1];
|
|
71
|
-
const parentPath = [...path].slice(0, -1);
|
|
72
|
-
const parent = get(object, parentPath);
|
|
73
|
-
if (typeof mutator === "function") {
|
|
74
|
-
parent[lastProperty] = mutator(parent[lastProperty]);
|
|
75
|
-
} else {
|
|
76
|
-
parent[lastProperty] = mutator;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
var extractPageInfos = (responseData) => {
|
|
80
|
-
const pageInfoPath = findPaginatedResourcePath(responseData);
|
|
81
|
-
return {
|
|
82
|
-
pathInQuery: pageInfoPath,
|
|
83
|
-
pageInfo: get(responseData, [...pageInfoPath, "pageInfo"])
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
var isForwardSearch = (givenPageInfo) => {
|
|
87
|
-
return givenPageInfo.hasOwnProperty("hasNextPage");
|
|
88
|
-
};
|
|
89
|
-
var getCursorFrom = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.endCursor : pageInfo.startCursor;
|
|
90
|
-
var hasAnotherPage = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.hasNextPage : pageInfo.hasPreviousPage;
|
|
91
|
-
var createIterator = (octokit) => {
|
|
92
|
-
return (query, initialParameters = {}) => {
|
|
93
|
-
let nextPageExists = true;
|
|
94
|
-
let parameters = { ...initialParameters };
|
|
95
|
-
return {
|
|
96
|
-
[Symbol.asyncIterator]: () => ({
|
|
97
|
-
async next() {
|
|
98
|
-
if (!nextPageExists) return { done: true, value: {} };
|
|
99
|
-
const response = await octokit.graphql(
|
|
100
|
-
query,
|
|
101
|
-
parameters
|
|
102
|
-
);
|
|
103
|
-
const pageInfoContext = extractPageInfos(response);
|
|
104
|
-
const nextCursorValue = getCursorFrom(pageInfoContext.pageInfo);
|
|
105
|
-
nextPageExists = hasAnotherPage(pageInfoContext.pageInfo);
|
|
106
|
-
if (nextPageExists && nextCursorValue === parameters.cursor) {
|
|
107
|
-
throw new MissingCursorChange(pageInfoContext, nextCursorValue);
|
|
108
|
-
}
|
|
109
|
-
parameters = {
|
|
110
|
-
...parameters,
|
|
111
|
-
cursor: nextCursorValue
|
|
112
|
-
};
|
|
113
|
-
return { done: false, value: response };
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
var mergeResponses = (response1, response2) => {
|
|
120
|
-
if (Object.keys(response1).length === 0) {
|
|
121
|
-
return Object.assign(response1, response2);
|
|
122
|
-
}
|
|
123
|
-
const path = findPaginatedResourcePath(response1);
|
|
124
|
-
const nodesPath = [...path, "nodes"];
|
|
125
|
-
const newNodes = get(response2, nodesPath);
|
|
126
|
-
if (newNodes) {
|
|
127
|
-
set(response1, nodesPath, (values) => {
|
|
128
|
-
return [...values, ...newNodes];
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
const edgesPath = [...path, "edges"];
|
|
132
|
-
const newEdges = get(response2, edgesPath);
|
|
133
|
-
if (newEdges) {
|
|
134
|
-
set(response1, edgesPath, (values) => {
|
|
135
|
-
return [...values, ...newEdges];
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
const pageInfoPath = [...path, "pageInfo"];
|
|
139
|
-
set(response1, pageInfoPath, get(response2, pageInfoPath));
|
|
140
|
-
return response1;
|
|
141
|
-
};
|
|
142
|
-
var createPaginate = (octokit) => {
|
|
143
|
-
const iterator = createIterator(octokit);
|
|
144
|
-
return async (query, initialParameters = {}) => {
|
|
145
|
-
let mergedResponse = {};
|
|
146
|
-
for await (const response of iterator(
|
|
147
|
-
query,
|
|
148
|
-
initialParameters
|
|
149
|
-
)) {
|
|
150
|
-
mergedResponse = mergeResponses(mergedResponse, response);
|
|
151
|
-
}
|
|
152
|
-
return mergedResponse;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
function paginateGraphQL(octokit) {
|
|
156
|
-
return {
|
|
157
|
-
graphql: Object.assign(octokit.graphql, {
|
|
158
|
-
paginate: Object.assign(createPaginate(octokit), {
|
|
159
|
-
iterator: createIterator(octokit)
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// src/octokit.ts
|
|
3
|
+
import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
|
|
166
4
|
import { paginateRest } from "@octokit/plugin-paginate-rest";
|
|
167
5
|
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
|
|
168
6
|
import { retry } from "@octokit/plugin-retry";
|
package/dist/signature.d.mts
CHANGED
|
@@ -15,9 +15,10 @@ declare class PluginInput<T extends EmitterWebhookEventName = EmitterWebhookEven
|
|
|
15
15
|
eventPayload: EmitterWebhookEvent<T>["payload"];
|
|
16
16
|
settings: unknown;
|
|
17
17
|
authToken: string;
|
|
18
|
+
ubiquityKernelToken?: string;
|
|
18
19
|
ref: string;
|
|
19
20
|
command: CommandCall;
|
|
20
|
-
constructor(privateKey: string, stateId: string, eventName: T, eventPayload: EmitterWebhookEvent<T>["payload"], settings: unknown, authToken: string, ref: string, command: CommandCall);
|
|
21
|
+
constructor(privateKey: string, stateId: string, eventName: T, eventPayload: EmitterWebhookEvent<T>["payload"], settings: unknown, authToken: string, ref: string, command: CommandCall, ubiquityKernelToken?: string);
|
|
21
22
|
getInputs(): Promise<{
|
|
22
23
|
signature: string;
|
|
23
24
|
stateId: string;
|
|
@@ -25,6 +26,7 @@ declare class PluginInput<T extends EmitterWebhookEventName = EmitterWebhookEven
|
|
|
25
26
|
eventPayload: string;
|
|
26
27
|
settings: string;
|
|
27
28
|
authToken: string;
|
|
29
|
+
ubiquityKernelToken: string | undefined;
|
|
28
30
|
ref: string;
|
|
29
31
|
command: string;
|
|
30
32
|
}>;
|
package/dist/signature.d.ts
CHANGED
|
@@ -15,9 +15,10 @@ declare class PluginInput<T extends EmitterWebhookEventName = EmitterWebhookEven
|
|
|
15
15
|
eventPayload: EmitterWebhookEvent<T>["payload"];
|
|
16
16
|
settings: unknown;
|
|
17
17
|
authToken: string;
|
|
18
|
+
ubiquityKernelToken?: string;
|
|
18
19
|
ref: string;
|
|
19
20
|
command: CommandCall;
|
|
20
|
-
constructor(privateKey: string, stateId: string, eventName: T, eventPayload: EmitterWebhookEvent<T>["payload"], settings: unknown, authToken: string, ref: string, command: CommandCall);
|
|
21
|
+
constructor(privateKey: string, stateId: string, eventName: T, eventPayload: EmitterWebhookEvent<T>["payload"], settings: unknown, authToken: string, ref: string, command: CommandCall, ubiquityKernelToken?: string);
|
|
21
22
|
getInputs(): Promise<{
|
|
22
23
|
signature: string;
|
|
23
24
|
stateId: string;
|
|
@@ -25,6 +26,7 @@ declare class PluginInput<T extends EmitterWebhookEventName = EmitterWebhookEven
|
|
|
25
26
|
eventPayload: string;
|
|
26
27
|
settings: string;
|
|
27
28
|
authToken: string;
|
|
29
|
+
ubiquityKernelToken: string | undefined;
|
|
28
30
|
ref: string;
|
|
29
31
|
command: string;
|
|
30
32
|
}>;
|
package/dist/signature.js
CHANGED
|
@@ -42,9 +42,10 @@ var PluginInput = class {
|
|
|
42
42
|
eventPayload;
|
|
43
43
|
settings;
|
|
44
44
|
authToken;
|
|
45
|
+
ubiquityKernelToken;
|
|
45
46
|
ref;
|
|
46
47
|
command;
|
|
47
|
-
constructor(privateKey, stateId, eventName, eventPayload, settings, authToken, ref, command) {
|
|
48
|
+
constructor(privateKey, stateId, eventName, eventPayload, settings, authToken, ref, command, ubiquityKernelToken) {
|
|
48
49
|
this._privateKey = privateKey;
|
|
49
50
|
this.stateId = stateId;
|
|
50
51
|
this.eventName = eventName;
|
|
@@ -53,6 +54,7 @@ var PluginInput = class {
|
|
|
53
54
|
this.authToken = authToken;
|
|
54
55
|
this.ref = ref;
|
|
55
56
|
this.command = command;
|
|
57
|
+
this.ubiquityKernelToken = ubiquityKernelToken;
|
|
56
58
|
}
|
|
57
59
|
async getInputs() {
|
|
58
60
|
const inputs = {
|
|
@@ -61,6 +63,7 @@ var PluginInput = class {
|
|
|
61
63
|
eventPayload: compressString(JSON.stringify(this.eventPayload)),
|
|
62
64
|
settings: JSON.stringify(this.settings),
|
|
63
65
|
authToken: this.authToken,
|
|
66
|
+
ubiquityKernelToken: this.ubiquityKernelToken,
|
|
64
67
|
ref: this.ref,
|
|
65
68
|
command: JSON.stringify(this.command)
|
|
66
69
|
};
|
|
@@ -83,7 +86,7 @@ async function verifySignature(publicKeyPem, inputs, signature) {
|
|
|
83
86
|
ref: inputs.ref,
|
|
84
87
|
command: inputs.command
|
|
85
88
|
};
|
|
86
|
-
const pemContents = publicKeyPem.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").
|
|
89
|
+
const pemContents = publicKeyPem.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").trim();
|
|
87
90
|
const binaryDer = Uint8Array.from(atob(pemContents), (c) => c.charCodeAt(0));
|
|
88
91
|
const publicKey = await crypto.subtle.importKey(
|
|
89
92
|
"spki",
|
|
@@ -104,7 +107,7 @@ async function verifySignature(publicKeyPem, inputs, signature) {
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
async function importRsaPrivateKey(pem) {
|
|
107
|
-
const pemContents = pem.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").
|
|
110
|
+
const pemContents = pem.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").trim();
|
|
108
111
|
const binaryDer = Uint8Array.from(atob(pemContents), (c) => c.charCodeAt(0));
|
|
109
112
|
return await crypto.subtle.importKey(
|
|
110
113
|
"pkcs8",
|
package/dist/signature.mjs
CHANGED
|
@@ -14,9 +14,10 @@ var PluginInput = class {
|
|
|
14
14
|
eventPayload;
|
|
15
15
|
settings;
|
|
16
16
|
authToken;
|
|
17
|
+
ubiquityKernelToken;
|
|
17
18
|
ref;
|
|
18
19
|
command;
|
|
19
|
-
constructor(privateKey, stateId, eventName, eventPayload, settings, authToken, ref, command) {
|
|
20
|
+
constructor(privateKey, stateId, eventName, eventPayload, settings, authToken, ref, command, ubiquityKernelToken) {
|
|
20
21
|
this._privateKey = privateKey;
|
|
21
22
|
this.stateId = stateId;
|
|
22
23
|
this.eventName = eventName;
|
|
@@ -25,6 +26,7 @@ var PluginInput = class {
|
|
|
25
26
|
this.authToken = authToken;
|
|
26
27
|
this.ref = ref;
|
|
27
28
|
this.command = command;
|
|
29
|
+
this.ubiquityKernelToken = ubiquityKernelToken;
|
|
28
30
|
}
|
|
29
31
|
async getInputs() {
|
|
30
32
|
const inputs = {
|
|
@@ -33,6 +35,7 @@ var PluginInput = class {
|
|
|
33
35
|
eventPayload: compressString(JSON.stringify(this.eventPayload)),
|
|
34
36
|
settings: JSON.stringify(this.settings),
|
|
35
37
|
authToken: this.authToken,
|
|
38
|
+
ubiquityKernelToken: this.ubiquityKernelToken,
|
|
36
39
|
ref: this.ref,
|
|
37
40
|
command: JSON.stringify(this.command)
|
|
38
41
|
};
|
|
@@ -55,7 +58,7 @@ async function verifySignature(publicKeyPem, inputs, signature) {
|
|
|
55
58
|
ref: inputs.ref,
|
|
56
59
|
command: inputs.command
|
|
57
60
|
};
|
|
58
|
-
const pemContents = publicKeyPem.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").
|
|
61
|
+
const pemContents = publicKeyPem.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").trim();
|
|
59
62
|
const binaryDer = Uint8Array.from(atob(pemContents), (c) => c.charCodeAt(0));
|
|
60
63
|
const publicKey = await crypto.subtle.importKey(
|
|
61
64
|
"spki",
|
|
@@ -76,7 +79,7 @@ async function verifySignature(publicKeyPem, inputs, signature) {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
async function importRsaPrivateKey(pem) {
|
|
79
|
-
const pemContents = pem.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").
|
|
82
|
+
const pemContents = pem.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").trim();
|
|
80
83
|
const binaryDer = Uint8Array.from(atob(pemContents), (c) => c.charCodeAt(0));
|
|
81
84
|
return await crypto.subtle.importKey(
|
|
82
85
|
"pkcs8",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubiquity-os/plugin-sdk",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.4",
|
|
4
4
|
"description": "SDK for plugin support.",
|
|
5
5
|
"author": "Ubiquity DAO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
44
44
|
"types": "./dist/index.d.ts",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"require": "./dist/index.js",
|
|
46
|
+
"import": "./dist/index.mjs"
|
|
47
47
|
},
|
|
48
48
|
"./manifest": {
|
|
49
49
|
"types": "./dist/manifest.d.ts",
|
|
@@ -90,17 +90,15 @@
|
|
|
90
90
|
"dist"
|
|
91
91
|
],
|
|
92
92
|
"scripts": {
|
|
93
|
-
"build": "tsup",
|
|
94
|
-
"
|
|
95
|
-
"format": "run-s format:*",
|
|
93
|
+
"sdk:build": "tsup",
|
|
94
|
+
"format": "run-s format:lint format:prettier format:cspell",
|
|
96
95
|
"format:lint": "eslint --fix .",
|
|
97
96
|
"format:prettier": "prettier --write .",
|
|
98
97
|
"format:cspell": "cspell **/*",
|
|
99
|
-
"jest:test": "jest --coverage",
|
|
100
98
|
"knip": "knip --config .github/knip.ts",
|
|
101
99
|
"knip-ci": "knip --no-exit-code --reporter json --config .github/knip.ts",
|
|
102
100
|
"prepare": "node .husky/install.mjs",
|
|
103
|
-
"
|
|
101
|
+
"jest:test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --setupFiles dotenv/config --coverage"
|
|
104
102
|
},
|
|
105
103
|
"keywords": [
|
|
106
104
|
"typescript",
|
|
@@ -110,48 +108,47 @@
|
|
|
110
108
|
"open-source"
|
|
111
109
|
],
|
|
112
110
|
"dependencies": {
|
|
113
|
-
"@
|
|
114
|
-
"@
|
|
115
|
-
"@octokit/
|
|
116
|
-
"@octokit/plugin-
|
|
117
|
-
"@octokit/plugin-rest
|
|
118
|
-
"@octokit/plugin-
|
|
119
|
-
"@octokit/plugin-
|
|
120
|
-
"@octokit/
|
|
121
|
-
"@octokit/types": "^
|
|
122
|
-
"@octokit/webhooks": "^
|
|
123
|
-
"@
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"openai": "^4.70.2"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"
|
|
111
|
+
"@actions/core": "^1.11.1",
|
|
112
|
+
"@actions/github": "^6.0.1",
|
|
113
|
+
"@octokit/core": "^7.0.6",
|
|
114
|
+
"@octokit/plugin-paginate-graphql": "^6.0.0",
|
|
115
|
+
"@octokit/plugin-paginate-rest": "^14.0.0",
|
|
116
|
+
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
|
|
117
|
+
"@octokit/plugin-retry": "^8.0.3",
|
|
118
|
+
"@octokit/plugin-throttling": "^11.0.3",
|
|
119
|
+
"@octokit/types": "^16.0.0",
|
|
120
|
+
"@octokit/webhooks": "^14.1.3",
|
|
121
|
+
"@ubiquity-os/ubiquity-os-logger": "^1.4.0",
|
|
122
|
+
"hono": "^4.10.6",
|
|
123
|
+
"js-yaml": "^4.1.1",
|
|
124
|
+
"openai": "^4.70.2"
|
|
125
|
+
},
|
|
126
|
+
"peerDependencies": {
|
|
127
|
+
"@sinclair/typebox": "0.34.41"
|
|
130
128
|
},
|
|
131
129
|
"devDependencies": {
|
|
132
|
-
"@
|
|
133
|
-
"@commitlint/
|
|
134
|
-
"@
|
|
135
|
-
"@cspell/dict-
|
|
136
|
-
"@cspell/dict-
|
|
137
|
-
"@
|
|
138
|
-
"@
|
|
139
|
-
"@
|
|
140
|
-
"@
|
|
141
|
-
"@swc/jest": "^0.2.
|
|
142
|
-
"@types/
|
|
143
|
-
"@types/
|
|
144
|
-
"@types/node": "^22.10.1",
|
|
130
|
+
"@commitlint/cli": "^18.6.1",
|
|
131
|
+
"@commitlint/config-conventional": "^18.6.3",
|
|
132
|
+
"@cspell/dict-node": "^4.0.3",
|
|
133
|
+
"@cspell/dict-software-terms": "^3.4.10",
|
|
134
|
+
"@cspell/dict-typescript": "^3.2.3",
|
|
135
|
+
"@eslint/js": "^9.39.1",
|
|
136
|
+
"@jest/globals": "^30.2.0",
|
|
137
|
+
"@mswjs/data": "0.15.0",
|
|
138
|
+
"@mswjs/http-middleware": "^0.10.3",
|
|
139
|
+
"@swc/jest": "^0.2.39",
|
|
140
|
+
"@types/js-yaml": "^4.0.9",
|
|
141
|
+
"@types/node": "^20.19.25",
|
|
145
142
|
"@ubiquity-os/eslint-plugin-no-empty-strings": "^1.0.3",
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"eslint": "^9.
|
|
143
|
+
"cross-env": "^7.0.3",
|
|
144
|
+
"cspell": "^8.19.4",
|
|
145
|
+
"eslint": "^9.39.1",
|
|
149
146
|
"eslint-config-prettier": "^9.1.2",
|
|
150
147
|
"eslint-plugin-check-file": "^2.8.0",
|
|
151
|
-
"eslint-plugin-prettier": "^5.
|
|
148
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
152
149
|
"eslint-plugin-sonarjs": "^3.0.5",
|
|
153
150
|
"husky": "^9.1.7",
|
|
154
|
-
"jest": "^
|
|
151
|
+
"jest": "^30.2.0",
|
|
155
152
|
"jest-junit": "^16.0.0",
|
|
156
153
|
"jest-md-dashboard": "^0.8.1",
|
|
157
154
|
"knip": "^5.69.1",
|