zitejs 0.9.142 → 0.9.143
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/cjs/integrations/rules.d.ts +8 -0
- package/dist/cjs/integrations/rules.js +19 -0
- package/dist/cjs/meta/index.d.ts +14 -0
- package/dist/cjs/meta/index.js +12 -0
- package/dist/cjs/notifications/index.d.ts +25 -0
- package/dist/cjs/notifications/index.js +12 -0
- package/dist/esm/integrations/rules.d.ts +8 -0
- package/dist/esm/integrations/rules.js +19 -0
- package/dist/esm/meta/index.d.ts +14 -0
- package/dist/esm/meta/index.js +8 -0
- package/dist/esm/notifications/index.d.ts +25 -0
- package/dist/esm/notifications/index.js +8 -0
- package/package.json +1 -1
- package/dist/cjs/start/describeBuilt.d.ts +0 -3
- package/dist/cjs/start/describeBuilt.js +0 -106
- package/dist/cjs/start/entries.d.ts +0 -20
- package/dist/cjs/start/entries.js +0 -104
- package/dist/cjs/start/problems.d.ts +0 -19
- package/dist/cjs/start/problems.js +0 -11
- package/dist/esm/start/describe.d.ts +0 -64
- package/dist/esm/start/describe.js +0 -176
- package/dist/esm/start/describeBuilt.d.ts +0 -3
- package/dist/esm/start/describeBuilt.js +0 -66
- package/dist/esm/start/descriptions.d.ts +0 -4
- package/dist/esm/start/descriptions.js +0 -47
- package/dist/esm/start/entries.d.ts +0 -20
- package/dist/esm/start/entries.js +0 -93
- package/dist/esm/start/host.d.ts +0 -3
- package/dist/esm/start/host.js +0 -4
- package/dist/esm/start/index.d.ts +0 -79
- package/dist/esm/start/index.js +0 -157
- package/dist/esm/start/instance.d.ts +0 -12
- package/dist/esm/start/instance.js +0 -73
- package/dist/esm/start/problems.d.ts +0 -19
- package/dist/esm/start/problems.js +0 -8
- package/dist/esm/start/registration.d.ts +0 -13
- package/dist/esm/start/registration.js +0 -21
- package/dist/esm/start/router.d.ts +0 -17
- package/dist/esm/start/router.js +0 -37
- package/dist/esm/start/runLog.d.ts +0 -5
- package/dist/esm/start/runLog.js +0 -18
- package/dist/esm/start/scope.d.ts +0 -15
- package/dist/esm/start/scope.js +0 -58
- package/dist/esm/start/server.d.ts +0 -51
- package/dist/esm/start/server.js +0 -215
- package/dist/esm/start/types.d.ts +0 -94
- package/dist/esm/start/types.js +0 -1
- package/dist/esm/start/vite.d.ts +0 -9
- package/dist/esm/start/vite.js +0 -144
- package/dist/esm/start/worker.d.ts +0 -11
- package/dist/esm/start/worker.js +0 -20
- package/dist/esm/start/workflow.d.ts +0 -50
- package/dist/esm/start/workflow.js +0 -13
- package/dist/esm/start/workflow.test-d.d.ts +0 -1
- package/dist/esm/start/workflow.test-d.js +0 -39
- package/dist/esm/start/workflowModules.d.ts +0 -1
- package/dist/esm/start/workflowModules.js +0 -3
- package/dist/esm/start/workflowRun.d.ts +0 -80
- package/dist/esm/start/workflowRun.js +0 -107
|
@@ -43,9 +43,17 @@ declare const FIELDS_BY_TYPE: {
|
|
|
43
43
|
granola: readonly string[];
|
|
44
44
|
clickup: readonly string[];
|
|
45
45
|
dropbox: readonly string[];
|
|
46
|
+
zendesk: readonly string[];
|
|
46
47
|
amazonS3: readonly string[];
|
|
47
48
|
snowflake: readonly string[];
|
|
48
49
|
databricks: readonly string[];
|
|
50
|
+
confluence: readonly string[];
|
|
51
|
+
pipedrive: readonly string[];
|
|
52
|
+
shopify: readonly string[];
|
|
53
|
+
sharepoint: readonly string[];
|
|
54
|
+
excel: readonly string[];
|
|
55
|
+
x: readonly string[];
|
|
56
|
+
zoomMeetings: readonly string[];
|
|
49
57
|
smartsuite: readonly string[];
|
|
50
58
|
};
|
|
51
59
|
/** A service type `integrations.get` serves: one used through its npm package with a token. */
|
|
@@ -52,6 +52,10 @@ const FIELDS_BY_TYPE = {
|
|
|
52
52
|
granola: extras(),
|
|
53
53
|
clickup: extras(),
|
|
54
54
|
dropbox: extras(),
|
|
55
|
+
// Every path is https://{subdomain}.zendesk.com/api/v2/..., and a token is
|
|
56
|
+
// only valid on the account it was issued for, so the subdomain travels with
|
|
57
|
+
// it rather than being configured per app.
|
|
58
|
+
zendesk: extras("subdomain"),
|
|
55
59
|
// The IAM key alone reaches nothing: every call needs the region and the
|
|
56
60
|
// bucket, and S3-compatible providers need the endpoint too.
|
|
57
61
|
amazonS3: extras("keyId", "region", "bucket", "endpoint", "pathPrefix"),
|
|
@@ -61,6 +65,20 @@ const FIELDS_BY_TYPE = {
|
|
|
61
65
|
// A statement is addressed by workspace host and SQL warehouse, and the token
|
|
62
66
|
// derives neither.
|
|
63
67
|
databricks: extras("host", "warehouseId"),
|
|
68
|
+
// Cloud Confluence is addressed through api.atlassian.com by cloud id, the
|
|
69
|
+
// same as Jira; the site URL is only for links a human will click.
|
|
70
|
+
confluence: extras("cloudId", "siteUrl"),
|
|
71
|
+
// OAuth returns a per-company api_domain alongside the token, so there is no
|
|
72
|
+
// one host to call.
|
|
73
|
+
pipedrive: extras("apiBaseUrl"),
|
|
74
|
+
// Shopify has no global API host: every call goes to the store's own domain
|
|
75
|
+
// under a pinned API version. The storefront pair is the shopper-facing API,
|
|
76
|
+
// which installs predating those scopes do not have.
|
|
77
|
+
shopify: extras("shopDomain", "apiBaseUrl", "storefrontApiUrl", "storefrontAccessToken"),
|
|
78
|
+
sharepoint: extras(),
|
|
79
|
+
excel: extras(),
|
|
80
|
+
x: extras(),
|
|
81
|
+
zoomMeetings: extras(),
|
|
64
82
|
// Every request names the workspace in an Account-Id header beside the key.
|
|
65
83
|
smartsuite: extras("workspaceId"),
|
|
66
84
|
};
|
|
@@ -75,6 +93,7 @@ exports.OPTIONAL_CREDENTIAL_FIELDS = {
|
|
|
75
93
|
// Only S3-compatible providers set an endpoint, and a prefix is opt-in.
|
|
76
94
|
amazonS3: ["endpoint", "pathPrefix"],
|
|
77
95
|
snowflake: ["warehouse"],
|
|
96
|
+
shopify: ["storefrontApiUrl", "storefrontAccessToken"],
|
|
78
97
|
};
|
|
79
98
|
/**
|
|
80
99
|
* Types the runtime never serves: those with a generated client (Airtable, email,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ZiteProjectUser = {
|
|
2
|
+
uuid: string;
|
|
3
|
+
firstName: string | null;
|
|
4
|
+
lastName: string | null;
|
|
5
|
+
email: string;
|
|
6
|
+
profilePictureUrl: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type MetaListUsersResult = {
|
|
9
|
+
users: ZiteProjectUser[];
|
|
10
|
+
};
|
|
11
|
+
export declare class ZiteMeta {
|
|
12
|
+
static listUsers(): Promise<MetaListUsersResult>;
|
|
13
|
+
}
|
|
14
|
+
export declare const Meta: typeof ZiteMeta;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Meta = exports.ZiteMeta = void 0;
|
|
4
|
+
const sdkCall_js_1 = require("../internal/sdkCall.js");
|
|
5
|
+
const META_SDK_INTEGRATION_ID = '__meta__';
|
|
6
|
+
class ZiteMeta {
|
|
7
|
+
static listUsers() {
|
|
8
|
+
return (0, sdkCall_js_1.getSdkCall)()(META_SDK_INTEGRATION_ID, 'ZiteMeta', 'listUsers', {});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ZiteMeta = ZiteMeta;
|
|
12
|
+
exports.Meta = ZiteMeta;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface NotificationLink {
|
|
2
|
+
path?: string;
|
|
3
|
+
params?: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export type NotificationsCreateParams = {
|
|
6
|
+
recipients: string[];
|
|
7
|
+
title: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
link?: NotificationLink;
|
|
10
|
+
path?: string;
|
|
11
|
+
params?: Record<string, string>;
|
|
12
|
+
payload?: Record<string, unknown>;
|
|
13
|
+
idempotencyKey?: string;
|
|
14
|
+
};
|
|
15
|
+
export type NotificationsCreateResult = {
|
|
16
|
+
created: number;
|
|
17
|
+
} | {
|
|
18
|
+
created: 0;
|
|
19
|
+
preview: true;
|
|
20
|
+
wouldCreate: number;
|
|
21
|
+
};
|
|
22
|
+
export declare class ZiteNotifications {
|
|
23
|
+
static create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
|
|
24
|
+
}
|
|
25
|
+
export declare const Notifications: typeof ZiteNotifications;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Notifications = exports.ZiteNotifications = void 0;
|
|
4
|
+
const sdkCall_js_1 = require("../internal/sdkCall.js");
|
|
5
|
+
const NOTIFICATIONS_SDK_INTEGRATION_ID = '__notifications__';
|
|
6
|
+
class ZiteNotifications {
|
|
7
|
+
static create(params) {
|
|
8
|
+
return (0, sdkCall_js_1.getSdkCall)()(NOTIFICATIONS_SDK_INTEGRATION_ID, 'ZiteNotifications', 'create', params);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ZiteNotifications = ZiteNotifications;
|
|
12
|
+
exports.Notifications = ZiteNotifications;
|
|
@@ -43,9 +43,17 @@ declare const FIELDS_BY_TYPE: {
|
|
|
43
43
|
granola: readonly string[];
|
|
44
44
|
clickup: readonly string[];
|
|
45
45
|
dropbox: readonly string[];
|
|
46
|
+
zendesk: readonly string[];
|
|
46
47
|
amazonS3: readonly string[];
|
|
47
48
|
snowflake: readonly string[];
|
|
48
49
|
databricks: readonly string[];
|
|
50
|
+
confluence: readonly string[];
|
|
51
|
+
pipedrive: readonly string[];
|
|
52
|
+
shopify: readonly string[];
|
|
53
|
+
sharepoint: readonly string[];
|
|
54
|
+
excel: readonly string[];
|
|
55
|
+
x: readonly string[];
|
|
56
|
+
zoomMeetings: readonly string[];
|
|
49
57
|
smartsuite: readonly string[];
|
|
50
58
|
};
|
|
51
59
|
/** A service type `integrations.get` serves: one used through its npm package with a token. */
|
|
@@ -49,6 +49,10 @@ const FIELDS_BY_TYPE = {
|
|
|
49
49
|
granola: extras(),
|
|
50
50
|
clickup: extras(),
|
|
51
51
|
dropbox: extras(),
|
|
52
|
+
// Every path is https://{subdomain}.zendesk.com/api/v2/..., and a token is
|
|
53
|
+
// only valid on the account it was issued for, so the subdomain travels with
|
|
54
|
+
// it rather than being configured per app.
|
|
55
|
+
zendesk: extras("subdomain"),
|
|
52
56
|
// The IAM key alone reaches nothing: every call needs the region and the
|
|
53
57
|
// bucket, and S3-compatible providers need the endpoint too.
|
|
54
58
|
amazonS3: extras("keyId", "region", "bucket", "endpoint", "pathPrefix"),
|
|
@@ -58,6 +62,20 @@ const FIELDS_BY_TYPE = {
|
|
|
58
62
|
// A statement is addressed by workspace host and SQL warehouse, and the token
|
|
59
63
|
// derives neither.
|
|
60
64
|
databricks: extras("host", "warehouseId"),
|
|
65
|
+
// Cloud Confluence is addressed through api.atlassian.com by cloud id, the
|
|
66
|
+
// same as Jira; the site URL is only for links a human will click.
|
|
67
|
+
confluence: extras("cloudId", "siteUrl"),
|
|
68
|
+
// OAuth returns a per-company api_domain alongside the token, so there is no
|
|
69
|
+
// one host to call.
|
|
70
|
+
pipedrive: extras("apiBaseUrl"),
|
|
71
|
+
// Shopify has no global API host: every call goes to the store's own domain
|
|
72
|
+
// under a pinned API version. The storefront pair is the shopper-facing API,
|
|
73
|
+
// which installs predating those scopes do not have.
|
|
74
|
+
shopify: extras("shopDomain", "apiBaseUrl", "storefrontApiUrl", "storefrontAccessToken"),
|
|
75
|
+
sharepoint: extras(),
|
|
76
|
+
excel: extras(),
|
|
77
|
+
x: extras(),
|
|
78
|
+
zoomMeetings: extras(),
|
|
61
79
|
// Every request names the workspace in an Account-Id header beside the key.
|
|
62
80
|
smartsuite: extras("workspaceId"),
|
|
63
81
|
};
|
|
@@ -72,6 +90,7 @@ export const OPTIONAL_CREDENTIAL_FIELDS = {
|
|
|
72
90
|
// Only S3-compatible providers set an endpoint, and a prefix is opt-in.
|
|
73
91
|
amazonS3: ["endpoint", "pathPrefix"],
|
|
74
92
|
snowflake: ["warehouse"],
|
|
93
|
+
shopify: ["storefrontApiUrl", "storefrontAccessToken"],
|
|
75
94
|
};
|
|
76
95
|
/**
|
|
77
96
|
* Types the runtime never serves: those with a generated client (Airtable, email,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ZiteProjectUser = {
|
|
2
|
+
uuid: string;
|
|
3
|
+
firstName: string | null;
|
|
4
|
+
lastName: string | null;
|
|
5
|
+
email: string;
|
|
6
|
+
profilePictureUrl: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type MetaListUsersResult = {
|
|
9
|
+
users: ZiteProjectUser[];
|
|
10
|
+
};
|
|
11
|
+
export declare class ZiteMeta {
|
|
12
|
+
static listUsers(): Promise<MetaListUsersResult>;
|
|
13
|
+
}
|
|
14
|
+
export declare const Meta: typeof ZiteMeta;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface NotificationLink {
|
|
2
|
+
path?: string;
|
|
3
|
+
params?: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export type NotificationsCreateParams = {
|
|
6
|
+
recipients: string[];
|
|
7
|
+
title: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
link?: NotificationLink;
|
|
10
|
+
path?: string;
|
|
11
|
+
params?: Record<string, string>;
|
|
12
|
+
payload?: Record<string, unknown>;
|
|
13
|
+
idempotencyKey?: string;
|
|
14
|
+
};
|
|
15
|
+
export type NotificationsCreateResult = {
|
|
16
|
+
created: number;
|
|
17
|
+
} | {
|
|
18
|
+
created: 0;
|
|
19
|
+
preview: true;
|
|
20
|
+
wouldCreate: number;
|
|
21
|
+
};
|
|
22
|
+
export declare class ZiteNotifications {
|
|
23
|
+
static create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
|
|
24
|
+
}
|
|
25
|
+
export declare const Notifications: typeof ZiteNotifications;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getSdkCall } from '../internal/sdkCall.js';
|
|
2
|
+
const NOTIFICATIONS_SDK_INTEGRATION_ID = '__notifications__';
|
|
3
|
+
export class ZiteNotifications {
|
|
4
|
+
static create(params) {
|
|
5
|
+
return getSdkCall()(NOTIFICATIONS_SDK_INTEGRATION_ID, 'ZiteNotifications', 'create', params);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export const Notifications = ZiteNotifications;
|
package/package.json
CHANGED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.describeBuiltApp = describeBuiltApp;
|
|
40
|
-
exports.runDescribe = runDescribe;
|
|
41
|
-
const node_child_process_1 = require("node:child_process");
|
|
42
|
-
const node_fs_1 = require("node:fs");
|
|
43
|
-
const node_net_1 = require("node:net");
|
|
44
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
45
|
-
const node_url_1 = require("node:url");
|
|
46
|
-
// Only the host can set x-zite-* in production: the front strips them from public traffic.
|
|
47
|
-
const DESCRIBE_HEADERS = { "x-zite-invoke": "describe" };
|
|
48
|
-
// Not "localhost": it can resolve to ::1 for vite's listen and to 127.0.0.1 for fetch.
|
|
49
|
-
const HOST = "127.0.0.1";
|
|
50
|
-
const freePort = () => new Promise((resolve, reject) => {
|
|
51
|
-
const server = (0, node_net_1.createServer)();
|
|
52
|
-
server.once("error", reject);
|
|
53
|
-
server.listen(0, HOST, () => {
|
|
54
|
-
const { port } = server.address();
|
|
55
|
-
server.close(() => resolve(port));
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
// A Workers build runs where it will run: workerd, through the app's own
|
|
59
|
-
// `vite preview`, so it uses the same Cloudflare plugin and config as the build.
|
|
60
|
-
async function describeInWorkerd(appDir) {
|
|
61
|
-
const port = await freePort();
|
|
62
|
-
// Its own process group, so stopping it also stops vite and workerd under npx.
|
|
63
|
-
const preview = (0, node_child_process_1.spawn)("npx", ["--no-install", "vite", "preview", "--host", HOST, "--port", String(port), "--strictPort"], {
|
|
64
|
-
cwd: appDir,
|
|
65
|
-
stdio: ["ignore", "ignore", "pipe"],
|
|
66
|
-
detached: true,
|
|
67
|
-
});
|
|
68
|
-
let stderr = "";
|
|
69
|
-
preview.stderr.on("data", (chunk) => (stderr += chunk));
|
|
70
|
-
try {
|
|
71
|
-
const deadline = Date.now() + 60_000;
|
|
72
|
-
while (true) {
|
|
73
|
-
try {
|
|
74
|
-
const response = await fetch(`http://${HOST}:${port}/`, { headers: DESCRIBE_HEADERS });
|
|
75
|
-
// Right after start, preview can answer before the Worker does; only the
|
|
76
|
-
// app's own describe answer is JSON.
|
|
77
|
-
if (response.ok && response.headers.get("content-type")?.includes("application/json")) {
|
|
78
|
-
return await response.json();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch { }
|
|
82
|
-
if (preview.exitCode !== null || Date.now() > deadline) {
|
|
83
|
-
throw new Error(`vite preview didn't serve the app: ${stderr.trim().slice(-500)}`);
|
|
84
|
-
}
|
|
85
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
89
|
-
try {
|
|
90
|
-
process.kill(-preview.pid, "SIGTERM");
|
|
91
|
-
}
|
|
92
|
-
catch { }
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/** Describes a built Start app from its `dist/server`: a Workers build in workerd, a Node build in-process. */
|
|
96
|
-
async function describeBuiltApp(appDir) {
|
|
97
|
-
const serverDir = node_path_1.default.join(appDir, "dist/server");
|
|
98
|
-
if ((0, node_fs_1.existsSync)(node_path_1.default.join(serverDir, "wrangler.json")))
|
|
99
|
-
return describeInWorkerd(appDir);
|
|
100
|
-
const { default: server } = await Promise.resolve(`${(0, node_url_1.pathToFileURL)(node_path_1.default.join(serverDir, "server.js")).href}`).then(s => __importStar(require(s)));
|
|
101
|
-
return (await server.fetch(new Request("http://describe.local/", { headers: DESCRIBE_HEADERS }))).json();
|
|
102
|
-
}
|
|
103
|
-
async function runDescribe() {
|
|
104
|
-
const appDir = node_path_1.default.resolve(process.argv[3] ?? ".");
|
|
105
|
-
process.stdout.write(`${JSON.stringify(await describeBuiltApp(appDir), null, 2)}\n`);
|
|
106
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { SourceDir } from "../sourceRoots.js";
|
|
2
|
-
export declare const START_SERVER_ENTRY = ".zite/server.ts";
|
|
3
|
-
export declare const START_INSTANCE_ENTRY = ".zite/start.ts";
|
|
4
|
-
export type StartTarget = "cloudflare" | "node";
|
|
5
|
-
/**
|
|
6
|
-
* The server entry every Start app builds with. Platform-owned: regenerated,
|
|
7
|
-
* never edited. On Workers it's an entrypoint the host can also call over RPC.
|
|
8
|
-
*/
|
|
9
|
-
export declare const renderStartServerEntry: (target?: StartTarget) => string;
|
|
10
|
-
/** The start instance: the platform's middleware, then the app's own `src/start.ts` when it has one. */
|
|
11
|
-
export declare const renderStartInstance: (hasAppStart: boolean) => string;
|
|
12
|
-
export declare const hasAppStart: (appDir: string) => boolean;
|
|
13
|
-
/** Writes `file` under `appDir` when its content differs. Returns whether it wrote. */
|
|
14
|
-
export declare const writeIfChanged: (appDir: string, file: string, content: string) => boolean;
|
|
15
|
-
export declare const isStartAppDir: (appPath: string) => boolean;
|
|
16
|
-
export declare function regenerateStartEntries(app: SourceDir): void;
|
|
17
|
-
/** App modules that mention createWorkflow: what the workflow registry imports. Describe decides what each one really exports. */
|
|
18
|
-
export declare function workflowFiles(appDir: string): string[];
|
|
19
|
-
/** The registry zite() builds in place of zitejs's empty one. */
|
|
20
|
-
export declare const renderWorkflowModules: (appDir: string, files: string[]) => string;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderWorkflowModules = exports.isStartAppDir = exports.writeIfChanged = exports.hasAppStart = exports.renderStartInstance = exports.renderStartServerEntry = exports.START_INSTANCE_ENTRY = exports.START_SERVER_ENTRY = void 0;
|
|
4
|
-
exports.regenerateStartEntries = regenerateStartEntries;
|
|
5
|
-
exports.workflowFiles = workflowFiles;
|
|
6
|
-
const node_fs_1 = require("node:fs");
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
|
-
exports.START_SERVER_ENTRY = ".zite/server.ts";
|
|
9
|
-
exports.START_INSTANCE_ENTRY = ".zite/start.ts";
|
|
10
|
-
const APP_START_FILES = ["src/start.ts", "src/start.tsx"];
|
|
11
|
-
/**
|
|
12
|
-
* The server entry every Start app builds with. Platform-owned: regenerated,
|
|
13
|
-
* never edited. On Workers it's an entrypoint the host can also call over RPC.
|
|
14
|
-
*/
|
|
15
|
-
const renderStartServerEntry = (target = "cloudflare") => target === "cloudflare"
|
|
16
|
-
? `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
17
|
-
import handler from '@tanstack/react-start/server-entry';
|
|
18
|
-
import { createZiteWorker } from 'zitejs/start/worker';
|
|
19
|
-
import { getRouter } from '../src/router';
|
|
20
|
-
|
|
21
|
-
export default createZiteWorker({ handler, getRouter });
|
|
22
|
-
`
|
|
23
|
-
: `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
24
|
-
import handler, { createServerEntry } from '@tanstack/react-start/server-entry';
|
|
25
|
-
import { createZiteFetch } from 'zitejs/start/server';
|
|
26
|
-
import { getRouter } from '../src/router';
|
|
27
|
-
|
|
28
|
-
export default createServerEntry({ fetch: createZiteFetch({ handler, getRouter }) });
|
|
29
|
-
`;
|
|
30
|
-
exports.renderStartServerEntry = renderStartServerEntry;
|
|
31
|
-
/** The start instance: the platform's middleware, then the app's own `src/start.ts` when it has one. */
|
|
32
|
-
const renderStartInstance = (hasAppStart) => hasAppStart
|
|
33
|
-
? `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
34
|
-
import { createZiteStart } from 'zitejs/start/instance';
|
|
35
|
-
import { startInstance as app } from '../src/start';
|
|
36
|
-
|
|
37
|
-
export const startInstance = createZiteStart(app);
|
|
38
|
-
`
|
|
39
|
-
: `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
40
|
-
import { createZiteStart } from 'zitejs/start/instance';
|
|
41
|
-
|
|
42
|
-
export const startInstance = createZiteStart();
|
|
43
|
-
`;
|
|
44
|
-
exports.renderStartInstance = renderStartInstance;
|
|
45
|
-
const hasAppStart = (appDir) => APP_START_FILES.some((file) => (0, node_fs_1.existsSync)((0, node_path_1.join)(appDir, file)));
|
|
46
|
-
exports.hasAppStart = hasAppStart;
|
|
47
|
-
/** Writes `file` under `appDir` when its content differs. Returns whether it wrote. */
|
|
48
|
-
const writeIfChanged = (appDir, file, content) => {
|
|
49
|
-
const target = (0, node_path_1.join)(appDir, file);
|
|
50
|
-
if ((0, node_fs_1.existsSync)(target) && (0, node_fs_1.readFileSync)(target, "utf-8") === content)
|
|
51
|
-
return false;
|
|
52
|
-
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(target), { recursive: true });
|
|
53
|
-
(0, node_fs_1.writeFileSync)(target, content);
|
|
54
|
-
return true;
|
|
55
|
-
};
|
|
56
|
-
exports.writeIfChanged = writeIfChanged;
|
|
57
|
-
const isStartAppDir = (appPath) => {
|
|
58
|
-
try {
|
|
59
|
-
return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(appPath, "zite.config.json"), "utf-8"))?.runtime === "start";
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
exports.isStartAppDir = isStartAppDir;
|
|
66
|
-
const isStartApp = (app) => (0, exports.isStartAppDir)(app.path);
|
|
67
|
-
function regenerateStartEntries(app) {
|
|
68
|
-
if (!isStartApp(app))
|
|
69
|
-
return;
|
|
70
|
-
const entries = [
|
|
71
|
-
[exports.START_SERVER_ENTRY, (0, exports.renderStartServerEntry)()],
|
|
72
|
-
[exports.START_INSTANCE_ENTRY, (0, exports.renderStartInstance)((0, exports.hasAppStart)(app.path))],
|
|
73
|
-
];
|
|
74
|
-
for (const [file, content] of entries) {
|
|
75
|
-
if ((0, exports.writeIfChanged)(app.path, file, content))
|
|
76
|
-
console.log(`Wrote ${(0, node_path_1.join)(app.path, file)}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const SOURCE_FILE = /\.[mc]?[jt]sx?$/;
|
|
80
|
-
const NOT_APP_CODE = /(\.(test|spec)\.[^.]+|\.d\.ts|routeTree\.gen\.ts)$/;
|
|
81
|
-
/** App modules that mention createWorkflow: what the workflow registry imports. Describe decides what each one really exports. */
|
|
82
|
-
function workflowFiles(appDir) {
|
|
83
|
-
const found = [];
|
|
84
|
-
const walk = (dir) => {
|
|
85
|
-
for (const entry of (0, node_fs_1.readdirSync)(dir, { withFileTypes: true })) {
|
|
86
|
-
const full = (0, node_path_1.join)(dir, entry.name);
|
|
87
|
-
if (entry.isDirectory()) {
|
|
88
|
-
if (entry.name !== "node_modules")
|
|
89
|
-
walk(full);
|
|
90
|
-
}
|
|
91
|
-
else if (SOURCE_FILE.test(entry.name) && !NOT_APP_CODE.test(entry.name) && (0, node_fs_1.readFileSync)(full, "utf-8").includes("createWorkflow")) {
|
|
92
|
-
found.push((0, node_path_1.relative)(appDir, full).split("\\").join("/"));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(appDir, "src")))
|
|
97
|
-
walk((0, node_path_1.join)(appDir, "src"));
|
|
98
|
-
return found.sort();
|
|
99
|
-
}
|
|
100
|
-
/** The registry zite() builds in place of zitejs's empty one. */
|
|
101
|
-
const renderWorkflowModules = (appDir, files) => `export const workflowModules = {\n${files
|
|
102
|
-
.map((file) => ` ${JSON.stringify(file)}: () => import(${JSON.stringify((0, node_path_1.join)(appDir, file))}),`)
|
|
103
|
-
.join("\n")}\n};\n`;
|
|
104
|
-
exports.renderWorkflowModules = renderWorkflowModules;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type WithProblems = {
|
|
2
|
-
problems: string[];
|
|
3
|
-
};
|
|
4
|
-
type Described = {
|
|
5
|
-
functions: Array<WithProblems & {
|
|
6
|
-
id: string;
|
|
7
|
-
file?: string;
|
|
8
|
-
}>;
|
|
9
|
-
routes: Array<WithProblems & {
|
|
10
|
-
path: string;
|
|
11
|
-
}>;
|
|
12
|
-
workflows?: Array<WithProblems & {
|
|
13
|
-
id: string;
|
|
14
|
-
file: string;
|
|
15
|
-
}>;
|
|
16
|
-
};
|
|
17
|
-
/** Every problem in a description, one line each, named by its rule. Any of them fails the build. */
|
|
18
|
-
export declare function descriptionProblems(description: Described): string[];
|
|
19
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.descriptionProblems = descriptionProblems;
|
|
4
|
-
/** Every problem in a description, one line each, named by its rule. Any of them fails the build. */
|
|
5
|
-
function descriptionProblems(description) {
|
|
6
|
-
return [
|
|
7
|
-
...description.functions.flatMap((f) => f.problems.map((p) => `function ${f.id}${f.file ? ` (${f.file})` : ""}: ${p}`)),
|
|
8
|
-
...description.routes.flatMap((r) => r.problems.map((p) => `route ${r.path}: ${p}`)),
|
|
9
|
-
...(description.workflows ?? []).flatMap((w) => w.problems.map((p) => `workflow ${w.id} (${w.file}): ${p}`)),
|
|
10
|
-
];
|
|
11
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { ZiteTrigger } from "../backend/index.js";
|
|
2
|
-
import type { LoadedWorkflow } from "./workflowRun.js";
|
|
3
|
-
import type { WorkflowConfig } from "./workflow.js";
|
|
4
|
-
export type Access = {
|
|
5
|
-
kind: "signedIn" | "anyone" | "webhook" | "none";
|
|
6
|
-
roles: string[];
|
|
7
|
-
paused?: true;
|
|
8
|
-
};
|
|
9
|
-
export type DescribedFunction = {
|
|
10
|
-
id: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
file?: string;
|
|
13
|
-
method?: string;
|
|
14
|
-
/** From the factory's `description` option; display-only. */
|
|
15
|
-
description?: string;
|
|
16
|
-
access: Access;
|
|
17
|
-
input?: unknown;
|
|
18
|
-
problems: string[];
|
|
19
|
-
};
|
|
20
|
-
export type DescribedRoute = {
|
|
21
|
-
path: string;
|
|
22
|
-
methods: Record<string, Access>;
|
|
23
|
-
problems: string[];
|
|
24
|
-
};
|
|
25
|
-
export type DescribedWorkflow = {
|
|
26
|
-
id: string;
|
|
27
|
-
file: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
schedule?: WorkflowConfig["schedule"];
|
|
30
|
-
/** As declared, without a provider trigger's `subscribe` and `unsubscribe`. */
|
|
31
|
-
trigger?: ZiteTrigger;
|
|
32
|
-
/** A provider trigger's: whether it can be taken down, and a hash of both functions' code, so publish registers it again when they change. */
|
|
33
|
-
registration?: {
|
|
34
|
-
unsubscribe: boolean;
|
|
35
|
-
hash: string;
|
|
36
|
-
};
|
|
37
|
-
problems: string[];
|
|
38
|
-
};
|
|
39
|
-
export type Description = {
|
|
40
|
-
functions: DescribedFunction[];
|
|
41
|
-
routes: DescribedRoute[];
|
|
42
|
-
workflows: DescribedWorkflow[];
|
|
43
|
-
};
|
|
44
|
-
export declare function describeFunction(id: string, request: Request): Promise<DescribedFunction>;
|
|
45
|
-
type RouteLike = {
|
|
46
|
-
fullPath: string;
|
|
47
|
-
parentRoute?: RouteLike;
|
|
48
|
-
options?: {
|
|
49
|
-
server?: {
|
|
50
|
-
middleware?: unknown[];
|
|
51
|
-
handlers?: unknown;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export declare function describeRoutes(routesById: Record<string, RouteLike>): DescribedRoute[];
|
|
56
|
-
export declare function describeWorkflows(workflows: LoadedWorkflow[]): DescribedWorkflow[];
|
|
57
|
-
export declare function describeApp(opts: {
|
|
58
|
-
fnIds: string[];
|
|
59
|
-
descriptions?: Record<string, string>;
|
|
60
|
-
getRouter: () => unknown;
|
|
61
|
-
request: Request;
|
|
62
|
-
workflows?: LoadedWorkflow[];
|
|
63
|
-
}): Promise<Description>;
|
|
64
|
-
export {};
|