@easyhook/core 1.0.2 → 1.3.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.
- package/package.json +1 -1
- package/dist/core/base.d.ts +0 -13
- package/dist/core/base.d.ts.map +0 -1
- package/dist/core/base.js +0 -40
- package/dist/core/base.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/types/events.d.ts +0 -6
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/events.js +0 -3
- package/dist/types/events.js.map +0 -1
- package/dist/types/payload.d.ts +0 -5
- package/dist/types/payload.d.ts.map +0 -1
- package/dist/types/payload.js +0 -3
- package/dist/types/payload.js.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -4
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/intents.d.ts +0 -6
- package/dist/utils/intents.d.ts.map +0 -1
- package/dist/utils/intents.js +0 -7
- package/dist/utils/intents.js.map +0 -1
- package/dist/utils/provider.d.ts +0 -6
- package/dist/utils/provider.d.ts.map +0 -1
- package/dist/utils/provider.js +0 -6
- package/dist/utils/provider.js.map +0 -1
- package/dist/validator/custom.d.ts +0 -6
- package/dist/validator/custom.d.ts.map +0 -1
- package/dist/validator/custom.js +0 -10
- package/dist/validator/custom.js.map +0 -1
- package/dist/validator/easydonate.d.ts +0 -10
- package/dist/validator/easydonate.d.ts.map +0 -1
- package/dist/validator/easydonate.js +0 -12
- package/dist/validator/easydonate.js.map +0 -1
- package/dist/validator/github.d.ts +0 -76
- package/dist/validator/github.d.ts.map +0 -1
- package/dist/validator/github.js +0 -101
- package/dist/validator/github.js.map +0 -1
- package/dist/validator/index.d.ts +0 -4
- package/dist/validator/index.d.ts.map +0 -1
- package/dist/validator/index.js +0 -5
- package/dist/validator/index.js.map +0 -1
package/package.json
CHANGED
package/dist/core/base.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { BaseEvents } from '../types/events.js';
|
|
3
|
-
import { HookIntentValue } from '../utils/intents.js';
|
|
4
|
-
import { HookProvider } from '../utils/provider.js';
|
|
5
|
-
export interface EasyhookOptions {
|
|
6
|
-
intents: HookIntentValue[];
|
|
7
|
-
}
|
|
8
|
-
export declare class Easyhook extends TypedEmitter<BaseEvents> {
|
|
9
|
-
private enabledIntents;
|
|
10
|
-
constructor(options: EasyhookOptions);
|
|
11
|
-
isWebhook(provider: HookProvider, body: unknown): void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=base.d.ts.map
|
package/dist/core/base.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/core/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,qBAAa,QAAS,SAAQ,YAAY,CAAC,UAAU,CAAC;IACpD,OAAO,CAAC,cAAc,CAAc;gBAExB,OAAO,EAAE,eAAe;IAK7B,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO;CA8BvD"}
|
package/dist/core/base.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { HookProvider } from '../utils/provider.js';
|
|
3
|
-
import { EasydonateSchema, GithubPushSchema } from '../validator/index.js';
|
|
4
|
-
import { type } from 'arktype';
|
|
5
|
-
import { WebhookValidationError } from '../validator/custom.js';
|
|
6
|
-
export class Easyhook extends TypedEmitter {
|
|
7
|
-
isWebhook(provider, body) {
|
|
8
|
-
if (!this.enabledIntents.has(provider)) {
|
|
9
|
-
throw new Error(`Intent for ${provider} is not enabled`);
|
|
10
|
-
}
|
|
11
|
-
switch(provider){
|
|
12
|
-
case HookProvider.EasyDonate:
|
|
13
|
-
{
|
|
14
|
-
const input = EasydonateSchema(body);
|
|
15
|
-
if (input instanceof type.errors) {
|
|
16
|
-
throw new WebhookValidationError(provider, input.summary);
|
|
17
|
-
}
|
|
18
|
-
this.emit('easydonate', input);
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
case HookProvider.Github:
|
|
22
|
-
{
|
|
23
|
-
const input = GithubPushSchema(body);
|
|
24
|
-
if (input instanceof type.errors) {
|
|
25
|
-
throw new WebhookValidationError(provider, input.summary);
|
|
26
|
-
}
|
|
27
|
-
this.emit('github', input);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
default:
|
|
31
|
-
throw new Error(`Unhandled provider: ${provider}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
constructor(options){
|
|
35
|
-
super();
|
|
36
|
-
this.enabledIntents = new Set(options.intents);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=base.js.map
|
package/dist/core/base.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/base.ts"],"sourcesContent":["import { TypedEmitter } from 'tiny-typed-emitter';\nimport { BaseEvents } from '../types/events.js';\nimport { HookIntentValue } from '../utils/intents.js';\nimport { HookProvider } from '../utils/provider.js';\nimport { EasydonateSchema, GithubPushSchema } from '../validator/index.js';\nimport { type } from 'arktype';\nimport { WebhookValidationError } from '../validator/custom.js';\n\nexport interface EasyhookOptions {\n intents: HookIntentValue[];\n}\n\nexport class Easyhook extends TypedEmitter<BaseEvents> {\n private enabledIntents: Set<string>;\n\n constructor(options: EasyhookOptions) {\n super();\n this.enabledIntents = new Set(options.intents);\n }\n\n public isWebhook(provider: HookProvider, body: unknown) {\n if (!this.enabledIntents.has(provider)) {\n throw new Error(`Intent for ${provider} is not enabled`);\n }\n\n switch (provider) {\n case HookProvider.EasyDonate: {\n const input = EasydonateSchema(body);\n\n if (input instanceof type.errors) {\n throw new WebhookValidationError(provider, input.summary);\n }\n\n this.emit('easydonate', input);\n break;\n }\n case HookProvider.Github: {\n const input = GithubPushSchema(body);\n\n if (input instanceof type.errors) {\n throw new WebhookValidationError(provider, input.summary);\n }\n\n this.emit('github', input);\n break;\n }\n default:\n throw new Error(`Unhandled provider: ${provider}`);\n }\n }\n}\n"],"names":["TypedEmitter","HookProvider","EasydonateSchema","GithubPushSchema","type","WebhookValidationError","Easyhook","isWebhook","provider","body","enabledIntents","has","Error","EasyDonate","input","errors","summary","emit","Github","constructor","options","Set","intents"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,qBAAqB;AAGlD,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,wBAAwB;AAC3E,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,sBAAsB,QAAQ,yBAAyB;AAMhE,OAAO,MAAMC,iBAAiBN;IAQrBO,UAAUC,QAAsB,EAAEC,IAAa,EAAE;QACtD,IAAI,CAAC,IAAI,CAACC,cAAc,CAACC,GAAG,CAACH,WAAW;YACtC,MAAM,IAAII,MAAM,CAAC,WAAW,EAAEJ,SAAS,eAAe,CAAC;QACzD;QAEA,OAAQA;YACN,KAAKP,aAAaY,UAAU;gBAAE;oBAC5B,MAAMC,QAAQZ,iBAAiBO;oBAE/B,IAAIK,iBAAiBV,KAAKW,MAAM,EAAE;wBAChC,MAAM,IAAIV,uBAAuBG,UAAUM,MAAME,OAAO;oBAC1D;oBAEA,IAAI,CAACC,IAAI,CAAC,cAAcH;oBACxB;gBACF;YACA,KAAKb,aAAaiB,MAAM;gBAAE;oBACxB,MAAMJ,QAAQX,iBAAiBM;oBAE/B,IAAIK,iBAAiBV,KAAKW,MAAM,EAAE;wBAChC,MAAM,IAAIV,uBAAuBG,UAAUM,MAAME,OAAO;oBAC1D;oBAEA,IAAI,CAACC,IAAI,CAAC,UAAUH;oBACpB;gBACF;YACA;gBACE,MAAM,IAAIF,MAAM,CAAC,oBAAoB,EAAEJ,SAAS,CAAC;QACrD;IACF;IAlCAW,YAAYC,OAAwB,CAAE;QACpC,KAAK;QACL,IAAI,CAACV,cAAc,GAAG,IAAIW,IAAID,QAAQE,OAAO;IAC/C;AAgCF"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './core/base.js';\nexport * from './utils/index.js';\nexport * from './validator/index.js';\nexport * from './types/events.js';\nexport * from './types/payload.js';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,qBAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"5.9.3"}
|
package/dist/types/events.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC9C"}
|
package/dist/types/events.js
DELETED
package/dist/types/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/events.ts"],"sourcesContent":["import type { EasyDonatePayload, GithubPushPayload } from './payload.js';\n\nexport interface BaseEvents {\n easydonate: (payload: EasyDonatePayload) => void;\n github: (payload: GithubPushPayload) => void;\n}\n"],"names":[],"rangeMappings":"","mappings":"AAEA,WAGC"}
|
package/dist/types/payload.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EasydonateSchema } from '../validator/easydonate.js';
|
|
2
|
-
import { GithubPushSchema } from '../validator/github.js';
|
|
3
|
-
export type EasyDonatePayload = typeof EasydonateSchema.infer;
|
|
4
|
-
export type GithubPushPayload = typeof GithubPushSchema.infer;
|
|
5
|
-
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/types/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,OAAO,gBAAgB,CAAC,KAAK,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,OAAO,gBAAgB,CAAC,KAAK,CAAC"}
|
package/dist/types/payload.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/payload.ts"],"sourcesContent":["import { EasydonateSchema } from '../validator/easydonate.js';\nimport { GithubPushSchema } from '../validator/github.js';\n\nexport type EasyDonatePayload = typeof EasydonateSchema.infer;\nexport type GithubPushPayload = typeof GithubPushSchema.infer;\n"],"names":[],"rangeMappings":"","mappings":"AAIA,WAA8D"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
package/dist/utils/index.js
DELETED
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './provider.js';\nexport * from './intents.js';\n"],"names":[],"rangeMappings":";","mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,eAAe"}
|
package/dist/utils/intents.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/utils/intents.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
|
package/dist/utils/intents.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/intents.ts"],"sourcesContent":["import { HookProvider } from './provider.js';\n\nexport const HookIntents = {\n EasyDonate: HookProvider.EasyDonate,\n Github: HookProvider.Github,\n} as const;\n\nexport type HookIntentValue = (typeof HookIntents)[keyof typeof HookIntents];\n"],"names":["HookProvider","HookIntents","EasyDonate","Github"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAE7C,OAAO,MAAMC,cAAc;IACzBC,YAAYF,aAAaE,UAAU;IACnCC,QAAQH,aAAaG,MAAM;AAC7B,EAAW"}
|
package/dist/utils/provider.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/utils/provider.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
|
package/dist/utils/provider.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/provider.ts"],"sourcesContent":["export const HookProvider = {\n EasyDonate: 'easydonate',\n Github: 'github',\n} as const;\n\nexport type HookProvider = (typeof HookProvider)[keyof typeof HookProvider];\n"],"names":["HookProvider","EasyDonate","Github"],"rangeMappings":";;;","mappings":"AAAA,OAAO,MAAMA,eAAe;IAC1BC,YAAY;IACZC,QAAQ;AACV,EAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/validator/custom.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;IAC5B,QAAQ,EAAE,MAAM;IAAS,OAAO,EAAE,MAAM;gBAAxC,QAAQ,EAAE,MAAM,EAAS,OAAO,EAAE,MAAM;CAI5D"}
|
package/dist/validator/custom.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export class WebhookValidationError extends Error {
|
|
2
|
-
constructor(provider, details){
|
|
3
|
-
super(`Invalid Payload for ${provider}`);
|
|
4
|
-
this.provider = provider;
|
|
5
|
-
this.details = details;
|
|
6
|
-
this.name = 'WebhookValidationError';
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=custom.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validator/custom.ts"],"sourcesContent":["export class WebhookValidationError extends Error {\n constructor(public provider: string, public details: string) {\n super(`Invalid Payload for ${provider}`);\n this.name = 'WebhookValidationError';\n }\n}\n"],"names":["WebhookValidationError","Error","constructor","provider","details","name"],"rangeMappings":";;;;;;;","mappings":"AAAA,OAAO,MAAMA,+BAA+BC;IAC1CC,YAAY,AAAOC,QAAgB,EAAE,AAAOC,OAAe,CAAE;QAC3D,KAAK,CAAC,CAAC,oBAAoB,EAAED,SAAS,CAAC;aADtBA,WAAAA;aAAyBC,UAAAA;QAE1C,IAAI,CAACC,IAAI,GAAG;IACd;AACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const EasydonateSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
2
|
-
provider: "easydonate";
|
|
3
|
-
referenceNo: string;
|
|
4
|
-
channelName: string;
|
|
5
|
-
donatorName: string;
|
|
6
|
-
donateMessage: string;
|
|
7
|
-
amount: number;
|
|
8
|
-
time: string;
|
|
9
|
-
}, {}>;
|
|
10
|
-
//# sourceMappingURL=easydonate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"easydonate.d.ts","sourceRoot":"","sources":["../../src/validator/easydonate.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;MAQ3B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type } from 'arktype';
|
|
2
|
-
export const EasydonateSchema = type({
|
|
3
|
-
provider: "'easydonate'",
|
|
4
|
-
referenceNo: 'string',
|
|
5
|
-
channelName: 'string',
|
|
6
|
-
donatorName: 'string',
|
|
7
|
-
donateMessage: 'string',
|
|
8
|
-
amount: 'number',
|
|
9
|
-
time: 'string'
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=easydonate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validator/easydonate.ts"],"sourcesContent":["import { type } from 'arktype';\n\nexport const EasydonateSchema = type({\n provider: \"'easydonate'\",\n referenceNo: 'string',\n channelName: 'string',\n donatorName: 'string',\n donateMessage: 'string',\n amount: 'number',\n time: 'string',\n});\n"],"names":["type","EasydonateSchema","provider","referenceNo","channelName","donatorName","donateMessage","amount","time"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAE/B,OAAO,MAAMC,mBAAmBD,KAAK;IACnCE,UAAU;IACVC,aAAa;IACbC,aAAa;IACbC,aAAa;IACbC,eAAe;IACfC,QAAQ;IACRC,MAAM;AACR,GAAG"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export declare const GithubPushSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
2
|
-
ref: string;
|
|
3
|
-
before: string;
|
|
4
|
-
after: string;
|
|
5
|
-
repository: {
|
|
6
|
-
id: number;
|
|
7
|
-
name: string;
|
|
8
|
-
full_name: string;
|
|
9
|
-
private: boolean;
|
|
10
|
-
owner: {
|
|
11
|
-
name: string;
|
|
12
|
-
login: string;
|
|
13
|
-
id: number;
|
|
14
|
-
avatar_url: string;
|
|
15
|
-
url: string;
|
|
16
|
-
email?: string | undefined;
|
|
17
|
-
};
|
|
18
|
-
html_url: string;
|
|
19
|
-
description: string | null;
|
|
20
|
-
fork: boolean;
|
|
21
|
-
url: string;
|
|
22
|
-
created_at: string | number;
|
|
23
|
-
updated_at: string;
|
|
24
|
-
pushed_at: string | number;
|
|
25
|
-
homepage: string | null;
|
|
26
|
-
size: number;
|
|
27
|
-
stargazers_count: number;
|
|
28
|
-
watchers_count: number;
|
|
29
|
-
language: string | null;
|
|
30
|
-
has_issues: boolean;
|
|
31
|
-
has_projects: boolean;
|
|
32
|
-
has_downloads: boolean;
|
|
33
|
-
has_wiki: boolean;
|
|
34
|
-
has_pages: boolean;
|
|
35
|
-
forks_count: number;
|
|
36
|
-
mirror_url: string | null;
|
|
37
|
-
open_issues_count: number;
|
|
38
|
-
forks: number;
|
|
39
|
-
open_issues: number;
|
|
40
|
-
watchers: number;
|
|
41
|
-
default_branch: string;
|
|
42
|
-
};
|
|
43
|
-
pusher: {
|
|
44
|
-
name: string;
|
|
45
|
-
email?: string | undefined;
|
|
46
|
-
};
|
|
47
|
-
sender: {
|
|
48
|
-
login: string;
|
|
49
|
-
id: number;
|
|
50
|
-
avatar_url: string;
|
|
51
|
-
url: string;
|
|
52
|
-
};
|
|
53
|
-
commits: {
|
|
54
|
-
id: string;
|
|
55
|
-
tree_id: string;
|
|
56
|
-
distinct: boolean;
|
|
57
|
-
message: string;
|
|
58
|
-
timestamp: string;
|
|
59
|
-
url: string;
|
|
60
|
-
author: {
|
|
61
|
-
name: string;
|
|
62
|
-
email: string;
|
|
63
|
-
username?: string | undefined;
|
|
64
|
-
};
|
|
65
|
-
committer: {
|
|
66
|
-
name: string;
|
|
67
|
-
email: string;
|
|
68
|
-
username?: string | undefined;
|
|
69
|
-
};
|
|
70
|
-
added: string[];
|
|
71
|
-
removed: string[];
|
|
72
|
-
modified: string[];
|
|
73
|
-
}[];
|
|
74
|
-
head_commit?: any;
|
|
75
|
-
}, {}>;
|
|
76
|
-
//# sourceMappingURL=github.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/validator/github.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgGb,GAAG;MA+BjB,CAAC"}
|
package/dist/validator/github.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { type } from 'arktype';
|
|
2
|
-
export const GithubPushSchema = type({
|
|
3
|
-
ref: 'string',
|
|
4
|
-
before: 'string',
|
|
5
|
-
after: 'string',
|
|
6
|
-
repository: {
|
|
7
|
-
id: 'number',
|
|
8
|
-
name: 'string',
|
|
9
|
-
full_name: 'string',
|
|
10
|
-
private: 'boolean',
|
|
11
|
-
owner: {
|
|
12
|
-
name: 'string',
|
|
13
|
-
email: 'string?',
|
|
14
|
-
login: 'string',
|
|
15
|
-
id: 'number',
|
|
16
|
-
avatar_url: 'string',
|
|
17
|
-
url: 'string'
|
|
18
|
-
},
|
|
19
|
-
html_url: 'string',
|
|
20
|
-
description: 'string|null',
|
|
21
|
-
fork: 'boolean',
|
|
22
|
-
url: 'string',
|
|
23
|
-
created_at: 'number|string',
|
|
24
|
-
updated_at: 'string',
|
|
25
|
-
pushed_at: 'number|string',
|
|
26
|
-
homepage: 'string|null',
|
|
27
|
-
size: 'number',
|
|
28
|
-
stargazers_count: 'number',
|
|
29
|
-
watchers_count: 'number',
|
|
30
|
-
language: 'string|null',
|
|
31
|
-
has_issues: 'boolean',
|
|
32
|
-
has_projects: 'boolean',
|
|
33
|
-
has_downloads: 'boolean',
|
|
34
|
-
has_wiki: 'boolean',
|
|
35
|
-
has_pages: 'boolean',
|
|
36
|
-
forks_count: 'number',
|
|
37
|
-
mirror_url: 'string|null',
|
|
38
|
-
open_issues_count: 'number',
|
|
39
|
-
forks: 'number',
|
|
40
|
-
open_issues: 'number',
|
|
41
|
-
watchers: 'number',
|
|
42
|
-
default_branch: 'string'
|
|
43
|
-
},
|
|
44
|
-
pusher: {
|
|
45
|
-
name: 'string',
|
|
46
|
-
email: 'string?'
|
|
47
|
-
},
|
|
48
|
-
sender: {
|
|
49
|
-
login: 'string',
|
|
50
|
-
id: 'number',
|
|
51
|
-
avatar_url: 'string',
|
|
52
|
-
url: 'string'
|
|
53
|
-
},
|
|
54
|
-
commits: type([
|
|
55
|
-
{
|
|
56
|
-
id: 'string',
|
|
57
|
-
tree_id: 'string',
|
|
58
|
-
distinct: 'boolean',
|
|
59
|
-
message: 'string',
|
|
60
|
-
timestamp: 'string',
|
|
61
|
-
url: 'string',
|
|
62
|
-
author: {
|
|
63
|
-
name: 'string',
|
|
64
|
-
email: 'string',
|
|
65
|
-
username: 'string?'
|
|
66
|
-
},
|
|
67
|
-
committer: {
|
|
68
|
-
name: 'string',
|
|
69
|
-
email: 'string',
|
|
70
|
-
username: 'string?'
|
|
71
|
-
},
|
|
72
|
-
added: 'string[]',
|
|
73
|
-
removed: 'string[]',
|
|
74
|
-
modified: 'string[]'
|
|
75
|
-
},
|
|
76
|
-
'[]'
|
|
77
|
-
]),
|
|
78
|
-
'head_commit?': {
|
|
79
|
-
id: 'string',
|
|
80
|
-
tree_id: 'string',
|
|
81
|
-
distinct: 'boolean',
|
|
82
|
-
message: 'string',
|
|
83
|
-
timestamp: 'string',
|
|
84
|
-
url: 'string',
|
|
85
|
-
author: {
|
|
86
|
-
name: 'string',
|
|
87
|
-
email: 'string',
|
|
88
|
-
username: 'string?'
|
|
89
|
-
},
|
|
90
|
-
committer: {
|
|
91
|
-
name: 'string',
|
|
92
|
-
email: 'string',
|
|
93
|
-
username: 'string?'
|
|
94
|
-
},
|
|
95
|
-
added: 'string[]',
|
|
96
|
-
removed: 'string[]',
|
|
97
|
-
modified: 'string[]'
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
//# sourceMappingURL=github.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validator/github.ts"],"sourcesContent":["import { type } from 'arktype';\n\nexport const GithubPushSchema = type({\n ref: 'string',\n before: 'string',\n after: 'string',\n repository: {\n id: 'number',\n name: 'string',\n full_name: 'string',\n private: 'boolean',\n owner: {\n name: 'string',\n email: 'string?',\n login: 'string',\n id: 'number',\n avatar_url: 'string',\n url: 'string',\n },\n html_url: 'string',\n description: 'string|null',\n fork: 'boolean',\n url: 'string',\n created_at: 'number|string',\n updated_at: 'string',\n pushed_at: 'number|string',\n homepage: 'string|null',\n size: 'number',\n stargazers_count: 'number',\n watchers_count: 'number',\n language: 'string|null',\n has_issues: 'boolean',\n has_projects: 'boolean',\n has_downloads: 'boolean',\n has_wiki: 'boolean',\n has_pages: 'boolean',\n forks_count: 'number',\n mirror_url: 'string|null',\n open_issues_count: 'number',\n forks: 'number',\n open_issues: 'number',\n watchers: 'number',\n default_branch: 'string',\n },\n pusher: {\n name: 'string',\n email: 'string?',\n },\n sender: {\n login: 'string',\n id: 'number',\n avatar_url: 'string',\n url: 'string',\n },\n commits: type([\n {\n id: 'string',\n tree_id: 'string',\n distinct: 'boolean',\n message: 'string',\n timestamp: 'string',\n url: 'string',\n author: {\n name: 'string',\n email: 'string',\n username: 'string?',\n },\n committer: {\n name: 'string',\n email: 'string',\n username: 'string?',\n },\n added: 'string[]',\n removed: 'string[]',\n modified: 'string[]',\n },\n '[]',\n ]),\n 'head_commit?': {\n id: 'string',\n tree_id: 'string',\n distinct: 'boolean',\n message: 'string',\n timestamp: 'string',\n url: 'string',\n author: {\n name: 'string',\n email: 'string',\n username: 'string?',\n },\n committer: {\n name: 'string',\n email: 'string',\n username: 'string?',\n },\n added: 'string[]',\n removed: 'string[]',\n modified: 'string[]',\n } as const as any, // ArkType doesn't support complex union literals in object keys easily without separate definition or helper, but wait. The user suggested: \"'head_commit?': '{ ... } | null'\".\n // Let's use the object definition form but wrapped in a union if possible or just use '...|null' string def if it was a string.\n // Since it's an object definition, I can't just make the key a string like 'head_commit?': '... | null'.\n // I need to check how arktype handles optional nullable objects.\n // Actually, arktype `type({...})` takes an object.\n // If I want it to be nullable, I might need to define the object type separately.\n // OR, I can use the string format for the whole property if I could serialize the object schema.\n // BUT, looking at the user request: \"change the field type to the object OR null, e.g., \"'head_commit?': '{ ... } | null'\"\"\n // This implies ArkType supports defining the value as a type definition.\n // Wait, the existing code uses object literal syntax for `head_commit`.\n // I will try to use the `type` wrapper for the value or just union it if ArkType allows `type({ key: { ... } | null })` (syntax error in TS).\n // The user suggestion: `head_commit?: ... | null`.\n // Let's try to define the inner object schema and union it with null.\n // Actually, simplest is to use `type` for the inner object?\n // Let's look at `repository` definition in lines 7-44. It is nested object.\n // If I want `head_commit` to be nullable, I should probably do:\n // 'head_commit?': type({ ... }).or('null')\n // Let's see if I can do that.\n // User said: \"allow null using arktype's union syntax ... e.g., \"'head_commit?': '{ ... } | null'\"\"\n // Maybe they meant replacing the object literal with a string representation if arktype supports it?\n // But `head_commit` has many fields.\n // I will define the `HeadCommitSchema` string constant or object and use it? No, keep it inline if possible.\n // PROPOSED FIX:\n // 'head_commit?': type({ ... }).or('null') if that works.\n // OR, maybe stricter: validation might fail if I just hack it.\n // Let's assume `type({ ... })` returns a Type.\n // So: `'head_commit?': type({ ... }).or('null')` should be valid JS/TS if `type` comes from `arktype`.\n // However, `head_commit?` is a key in the object passed to outer `type()`.\n // So the value must be a definition.\n // `type({ ... })` is a Type, which is a valid definition.\n // So I will convert the object literal to `type({...}).or('null')`.\n});\n"],"names":["type","GithubPushSchema","ref","before","after","repository","id","name","full_name","private","owner","email","login","avatar_url","url","html_url","description","fork","created_at","updated_at","pushed_at","homepage","size","stargazers_count","watchers_count","language","has_issues","has_projects","has_downloads","has_wiki","has_pages","forks_count","mirror_url","open_issues_count","forks","open_issues","watchers","default_branch","pusher","sender","commits","tree_id","distinct","message","timestamp","author","username","committer","added","removed","modified"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAE/B,OAAO,MAAMC,mBAAmBD,KAAK;IACnCE,KAAK;IACLC,QAAQ;IACRC,OAAO;IACPC,YAAY;QACVC,IAAI;QACJC,MAAM;QACNC,WAAW;QACXC,SAAS;QACTC,OAAO;YACLH,MAAM;YACNI,OAAO;YACPC,OAAO;YACPN,IAAI;YACJO,YAAY;YACZC,KAAK;QACP;QACAC,UAAU;QACVC,aAAa;QACbC,MAAM;QACNH,KAAK;QACLI,YAAY;QACZC,YAAY;QACZC,WAAW;QACXC,UAAU;QACVC,MAAM;QACNC,kBAAkB;QAClBC,gBAAgB;QAChBC,UAAU;QACVC,YAAY;QACZC,cAAc;QACdC,eAAe;QACfC,UAAU;QACVC,WAAW;QACXC,aAAa;QACbC,YAAY;QACZC,mBAAmB;QACnBC,OAAO;QACPC,aAAa;QACbC,UAAU;QACVC,gBAAgB;IAClB;IACAC,QAAQ;QACN/B,MAAM;QACNI,OAAO;IACT;IACA4B,QAAQ;QACN3B,OAAO;QACPN,IAAI;QACJO,YAAY;QACZC,KAAK;IACP;IACA0B,SAASxC,KAAK;QACZ;YACEM,IAAI;YACJmC,SAAS;YACTC,UAAU;YACVC,SAAS;YACTC,WAAW;YACX9B,KAAK;YACL+B,QAAQ;gBACNtC,MAAM;gBACNI,OAAO;gBACPmC,UAAU;YACZ;YACAC,WAAW;gBACTxC,MAAM;gBACNI,OAAO;gBACPmC,UAAU;YACZ;YACAE,OAAO;YACPC,SAAS;YACTC,UAAU;QACZ;QACA;KACD;IACD,gBAAgB;QACd5C,IAAI;QACJmC,SAAS;QACTC,UAAU;QACVC,SAAS;QACTC,WAAW;QACX9B,KAAK;QACL+B,QAAQ;YACNtC,MAAM;YACNI,OAAO;YACPmC,UAAU;QACZ;QACAC,WAAW;YACTxC,MAAM;YACNI,OAAO;YACPmC,UAAU;QACZ;QACAE,OAAO;QACPC,SAAS;QACTC,UAAU;IACZ;AA+BF,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
package/dist/validator/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/validator/index.ts"],"sourcesContent":["export * from './easydonate.js';\nexport * from './github.js';\nexport * from './custom.js';\n"],"names":[],"rangeMappings":";;","mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,cAAc"}
|