Skip to content

Commit 1afec50

Browse files
committed
chore: add apify-schema package
1 parent 1b1916c commit 1afec50

File tree

7 files changed

+180
-0
lines changed

7 files changed

+180
-0
lines changed

packages/apify-schema/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# @systemfsoftware/apify-schema
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"extends": "@systemfsoftware/api-extractor/api-extractor.json"
4+
}

packages/apify-schema/package.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "@systemfsoftware/apify-schema",
3+
"version": "0.0.1",
4+
"author": "Ryan Lee <ryanleecode@gmail.com>",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/systemfsoftware/essentials.git"
8+
},
9+
"type": "module",
10+
"main": "./dist/commonjs/mod.js",
11+
"types": "./dist/commonjs/mod.d.ts",
12+
"module": "./dist/esm/mod.js",
13+
"exports": {
14+
"./package.json": "./package.json",
15+
".": {
16+
"import": {
17+
"@systemfsoftware/source": "./src/mod.ts",
18+
"types": "./dist/esm/mod.d.ts",
19+
"default": "./dist/esm/mod.js"
20+
},
21+
"require": {
22+
"types": "./dist/commonjs/mod.d.ts",
23+
"default": "./dist/commonjs/mod.js"
24+
}
25+
}
26+
},
27+
"keywords": [
28+
"apify"
29+
],
30+
"files": [
31+
"dist"
32+
],
33+
"tshy": {
34+
"project": "./tsconfig.build.json",
35+
"exports": {
36+
"./package.json": "./package.json",
37+
".": "./src/mod.ts"
38+
},
39+
"sourceDialects": [
40+
"@systemfsoftware/source"
41+
]
42+
},
43+
"scripts": {
44+
"prepare": "pnpm turbo build",
45+
"clean": "rimraf dist .tshy .tshy-build",
46+
"build": "pnpm run clean && tshy && pnpm run extract",
47+
"extract": "api-extractor run"
48+
},
49+
"dependencies": {
50+
"@apify/consts": "^2.35.0"
51+
},
52+
"devDependencies": {
53+
"@systemfsoftware/api-extractor": "workspace:^",
54+
"effect": "^3.10.4"
55+
},
56+
"peerDependencies": {
57+
"effect": "^3.10.4"
58+
}
59+
}

packages/apify-schema/src/mod.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { ACTOR_JOB_STATUSES, WEBHOOK_EVENT_TYPE_GROUPS } from '@apify/consts'
2+
import { Schema as S } from 'effect'
3+
4+
/**
5+
* @public
6+
*/
7+
export const ActorRunStats = S.Struct({
8+
inputBodyLen: S.Number,
9+
restartCount: S.Number,
10+
resurrectCount: S.Number,
11+
memAvgBytes: S.Number,
12+
memMaxBytes: S.Number,
13+
memCurrentBytes: S.Number,
14+
cpuAvgUsage: S.Number,
15+
cpuMaxUsage: S.Number,
16+
cpuCurrentUsage: S.Number,
17+
netRxBytes: S.Number,
18+
netTxBytes: S.Number,
19+
durationMillis: S.Number,
20+
runTimeSecs: S.Number,
21+
metamorph: S.Number,
22+
computeUnits: S.Number,
23+
})
24+
25+
/**
26+
* @public
27+
*/
28+
export type ActorRunStats = S.Schema.Type<typeof ActorRunStats>
29+
30+
/**
31+
* @public
32+
*/
33+
export const ActorRunMeta = S.Struct({
34+
origin: S.String,
35+
clientIp: S.optionalWith(S.String, { nullable: true }),
36+
userAgent: S.String,
37+
})
38+
39+
/**
40+
* @public
41+
*/
42+
export type ActorRunMeta = S.Schema.Type<typeof ActorRunMeta>
43+
44+
/**
45+
* @public
46+
*/
47+
export const ActorRunResult = S.Struct({
48+
userId: S.String,
49+
resource: S.Struct({
50+
id: S.String,
51+
meta: ActorRunMeta,
52+
actId: S.optionalWith(S.String, { nullable: true }),
53+
status: S.Literal(...Object.values(ACTOR_JOB_STATUSES)),
54+
buildId: S.String,
55+
startedAt: S.Date,
56+
finishedAt: S.Date,
57+
buildNumber: S.String,
58+
usageTotalUsd: S.optionalWith(S.Number, { nullable: true }),
59+
defaultDatasetId: S.String,
60+
defaultRequestQueueId: S.String,
61+
defaultKeyValueStoreId: S.String,
62+
}),
63+
createdAt: S.Date,
64+
eventData: S.Struct({
65+
actorId: S.String,
66+
actorRunId: S.String,
67+
}),
68+
eventType: S.Literal(...Object.values(WEBHOOK_EVENT_TYPE_GROUPS.ACTOR_RUN_TERMINAL)),
69+
})
70+
71+
/**
72+
* @public
73+
*/
74+
export type ActorRunResult = S.Schema.Type<typeof ActorRunResult>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"verbatimModuleSyntax": false,
5+
"declarationMap": false,
6+
"sourceMap": false,
7+
"stripInternal": true
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "@total-typescript/tsconfig/tsc/no-dom/library-monorepo",
4+
"compilerOptions": {
5+
"customConditions": ["@systemfsoftware/source"]
6+
},
7+
"include": ["src"]
8+
}

pnpm-lock.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)