zitejs 0.9.139 → 0.9.141
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 +3 -0
- package/dist/cjs/integrations/rules.js +4 -0
- package/dist/cjs/start/describeBuilt.d.ts +3 -0
- package/dist/cjs/start/describeBuilt.js +106 -0
- package/dist/cjs/start/entries.d.ts +20 -0
- package/dist/cjs/start/entries.js +104 -0
- package/dist/cjs/start/problems.d.ts +19 -0
- package/dist/cjs/start/problems.js +11 -0
- package/dist/esm/integrations/rules.d.ts +3 -0
- package/dist/esm/integrations/rules.js +4 -0
- package/dist/esm/start/describe.d.ts +64 -0
- package/dist/esm/start/describe.js +176 -0
- package/dist/esm/start/describeBuilt.d.ts +3 -0
- package/dist/esm/start/describeBuilt.js +66 -0
- package/dist/esm/start/descriptions.d.ts +4 -0
- package/dist/esm/start/descriptions.js +47 -0
- package/dist/esm/start/entries.d.ts +20 -0
- package/dist/esm/start/entries.js +93 -0
- package/dist/esm/start/host.d.ts +3 -0
- package/dist/esm/start/host.js +4 -0
- package/dist/esm/start/index.d.ts +79 -0
- package/dist/esm/start/index.js +157 -0
- package/dist/esm/start/instance.d.ts +12 -0
- package/dist/esm/start/instance.js +73 -0
- package/dist/esm/start/problems.d.ts +19 -0
- package/dist/esm/start/problems.js +8 -0
- package/dist/esm/start/registration.d.ts +13 -0
- package/dist/esm/start/registration.js +21 -0
- package/dist/esm/start/router.d.ts +17 -0
- package/dist/esm/start/router.js +37 -0
- package/dist/esm/start/runLog.d.ts +5 -0
- package/dist/esm/start/runLog.js +18 -0
- package/dist/esm/start/scope.d.ts +15 -0
- package/dist/esm/start/scope.js +58 -0
- package/dist/esm/start/server.d.ts +51 -0
- package/dist/esm/start/server.js +215 -0
- package/dist/esm/start/types.d.ts +94 -0
- package/dist/esm/start/types.js +1 -0
- package/dist/esm/start/vite.d.ts +9 -0
- package/dist/esm/start/vite.js +144 -0
- package/dist/esm/start/worker.d.ts +11 -0
- package/dist/esm/start/worker.js +20 -0
- package/dist/esm/start/workflow.d.ts +50 -0
- package/dist/esm/start/workflow.js +13 -0
- package/dist/esm/start/workflow.test-d.d.ts +1 -0
- package/dist/esm/start/workflow.test-d.js +39 -0
- package/dist/esm/start/workflowModules.d.ts +1 -0
- package/dist/esm/start/workflowModules.js +3 -0
- package/dist/esm/start/workflowRun.d.ts +80 -0
- package/dist/esm/start/workflowRun.js +107 -0
- package/package.json +1 -1
- package/dist/cjs/meta/index.d.ts +0 -14
- package/dist/cjs/meta/index.js +0 -12
- package/dist/cjs/notifications/index.d.ts +0 -25
- package/dist/cjs/notifications/index.js +0 -12
- package/dist/esm/meta/index.d.ts +0 -14
- package/dist/esm/meta/index.js +0 -8
- package/dist/esm/notifications/index.d.ts +0 -25
- package/dist/esm/notifications/index.js +0 -8
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ZiteTrigger, ZiteTriggerContext, ZiteTriggerSubscribe, ZiteTriggerUnsubscribe } from "../backend/index.js";
|
|
2
|
+
import type { ZiteSchedule } from "../schedules/index.js";
|
|
3
|
+
declare const WORKFLOW: unique symbol;
|
|
4
|
+
type ProviderTriggerBase = Extract<ZiteTrigger, {
|
|
5
|
+
every?: never;
|
|
6
|
+
events?: never;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* A provider trigger, registered with the provider by its `subscribe` when the
|
|
10
|
+
* app is published and taken down by its `unsubscribe` when it no longer is.
|
|
11
|
+
* Both run on the platform with only the trigger's own connection.
|
|
12
|
+
*/
|
|
13
|
+
export type StartProviderTrigger = ProviderTriggerBase & {
|
|
14
|
+
subscribe: ZiteTriggerSubscribe;
|
|
15
|
+
unsubscribe?: ZiteTriggerUnsubscribe;
|
|
16
|
+
};
|
|
17
|
+
export type StartTrigger = Exclude<ZiteTrigger, ProviderTriggerBase> | StartProviderTrigger;
|
|
18
|
+
export type WorkflowConfig = {
|
|
19
|
+
/** What this workflow does, in a sentence. Shown in the editor. */
|
|
20
|
+
description?: string;
|
|
21
|
+
} & ({
|
|
22
|
+
schedule: ZiteSchedule;
|
|
23
|
+
trigger?: never;
|
|
24
|
+
} | {
|
|
25
|
+
trigger: StartTrigger;
|
|
26
|
+
schedule?: never;
|
|
27
|
+
});
|
|
28
|
+
/** What a workflow's handler gets. A trigger adds `trigger`, typed by the kind it declares. */
|
|
29
|
+
export type WorkflowArgs<TConfig extends WorkflowConfig> = {
|
|
30
|
+
input: unknown;
|
|
31
|
+
} & (TConfig extends {
|
|
32
|
+
trigger: infer T;
|
|
33
|
+
} ? {
|
|
34
|
+
trigger: ZiteTriggerContext<T>;
|
|
35
|
+
} : unknown);
|
|
36
|
+
export type Workflow<TConfig extends WorkflowConfig = WorkflowConfig> = {
|
|
37
|
+
readonly [WORKFLOW]: true;
|
|
38
|
+
readonly config: TConfig;
|
|
39
|
+
readonly handler: (args: WorkflowArgs<TConfig>) => unknown;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Scheduled or triggered work, in a `*.server.ts` file:
|
|
43
|
+
* `export const nightly = createWorkflow({ schedule }).handler(async () => { ... })`.
|
|
44
|
+
* Only the platform runs it. It has no user and no URL, and reads data like a server function does.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createWorkflow<const TConfig extends WorkflowConfig>(config: TConfig): {
|
|
47
|
+
handler: (fn: (args: WorkflowArgs<TConfig>) => unknown) => Workflow<TConfig>;
|
|
48
|
+
};
|
|
49
|
+
export declare const isWorkflow: (value: unknown) => value is Workflow;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Shared across copies of zitejs in one bundle, like the access scope.
|
|
2
|
+
const WORKFLOW = Symbol.for("zitejs:workflow");
|
|
3
|
+
/**
|
|
4
|
+
* Scheduled or triggered work, in a `*.server.ts` file:
|
|
5
|
+
* `export const nightly = createWorkflow({ schedule }).handler(async () => { ... })`.
|
|
6
|
+
* Only the platform runs it. It has no user and no URL, and reads data like a server function does.
|
|
7
|
+
*/
|
|
8
|
+
export function createWorkflow(config) {
|
|
9
|
+
return {
|
|
10
|
+
handler: (fn) => ({ [WORKFLOW]: true, config, handler: fn }),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export const isWorkflow = (value) => typeof value === "object" && value !== null && value[WORKFLOW] === true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, expectTypeOf, it } from "vitest";
|
|
2
|
+
import { createWorkflow } from "./workflow.js";
|
|
3
|
+
describe("createWorkflow handler args", () => {
|
|
4
|
+
it("gives a schedule no trigger", () => {
|
|
5
|
+
createWorkflow({ schedule: { scheduleType: "oneTime", fireAt: "2026-10-10T03:00:00Z", timezone: "UTC" } }).handler((args) => {
|
|
6
|
+
expectTypeOf(args).toEqualTypeOf();
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
it("types the trigger by the kind it declares", () => {
|
|
10
|
+
createWorkflow({ trigger: { every: "5m" } }).handler(({ trigger }) => {
|
|
11
|
+
expectTypeOf(trigger).toEqualTypeOf();
|
|
12
|
+
});
|
|
13
|
+
createWorkflow({ trigger: { integration: "slack", events: ["message.channels"] } }).handler(({ trigger }) => {
|
|
14
|
+
expectTypeOf(trigger).toEqualTypeOf();
|
|
15
|
+
});
|
|
16
|
+
createWorkflow({
|
|
17
|
+
trigger: { integration: "asana", subscribe: async () => ({ externalId: "w1" }), unsubscribe: async () => { } },
|
|
18
|
+
}).handler(({ trigger }) => {
|
|
19
|
+
expectTypeOf(trigger).toEqualTypeOf();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
it("registers a provider trigger with subscribe", () => {
|
|
23
|
+
// @ts-expect-error nothing would register it with the provider
|
|
24
|
+
createWorkflow({ trigger: { integration: "asana" } });
|
|
25
|
+
createWorkflow({
|
|
26
|
+
trigger: {
|
|
27
|
+
integration: "github",
|
|
28
|
+
subscribe: (input) => {
|
|
29
|
+
expectTypeOf(input.notificationUrl).toEqualTypeOf();
|
|
30
|
+
return { externalId: "1", secret: input.secret };
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
it("takes a schedule or a trigger, not both", () => {
|
|
36
|
+
// @ts-expect-error a workflow runs on one or the other
|
|
37
|
+
createWorkflow({ schedule: { scheduleType: "oneTime", fireAt: "x", timezone: "UTC" }, trigger: { every: "5m" } });
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const workflowModules: Record<string, () => Promise<Record<string, unknown>>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type Workflow } from "./workflow.js";
|
|
2
|
+
export type TriggerReport = {
|
|
3
|
+
handled: string[];
|
|
4
|
+
cursor?: string;
|
|
5
|
+
};
|
|
6
|
+
export type WorkflowRunResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
output: unknown;
|
|
9
|
+
trigger?: TriggerReport;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
error: {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
trigger?: TriggerReport;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Splits the platform's state out of the input. A poll or a provider delivery
|
|
20
|
+
* with a cursor gets `seen`, `handled` and `advance`. Handled ids are reported
|
|
21
|
+
* whether or not the run throws, so an item acted on is never acted on again;
|
|
22
|
+
* the staged cursor only on success. Only ids the incoming `seen` lacked are
|
|
23
|
+
* reported: billing reads an empty list as a run that found nothing new.
|
|
24
|
+
*/
|
|
25
|
+
export declare function triggerContext(workflow: Workflow, rawInput: unknown): {
|
|
26
|
+
input: unknown;
|
|
27
|
+
trigger?: undefined;
|
|
28
|
+
report?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
input: {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
trigger: {
|
|
34
|
+
provider: string;
|
|
35
|
+
deliveryId?: string | undefined;
|
|
36
|
+
headers: Record<string, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
headers?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
headers: {};
|
|
41
|
+
};
|
|
42
|
+
report?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
input: {
|
|
45
|
+
[x: string]: unknown;
|
|
46
|
+
};
|
|
47
|
+
trigger: {
|
|
48
|
+
provider: string;
|
|
49
|
+
deliveryId?: string | undefined;
|
|
50
|
+
headers: Record<string, unknown>;
|
|
51
|
+
cursor: string | null;
|
|
52
|
+
seen: (id: string) => boolean;
|
|
53
|
+
handled: (id: string) => void;
|
|
54
|
+
advance: (cursor: string) => void;
|
|
55
|
+
} | {
|
|
56
|
+
headers?: undefined;
|
|
57
|
+
cursor: string | null;
|
|
58
|
+
seen: (id: string) => boolean;
|
|
59
|
+
handled: (id: string) => void;
|
|
60
|
+
advance: (cursor: string) => void;
|
|
61
|
+
} | {
|
|
62
|
+
headers: {};
|
|
63
|
+
cursor: string | null;
|
|
64
|
+
seen: (id: string) => boolean;
|
|
65
|
+
handled: (id: string) => void;
|
|
66
|
+
advance: (cursor: string) => void;
|
|
67
|
+
};
|
|
68
|
+
report: (succeeded: boolean) => TriggerReport;
|
|
69
|
+
};
|
|
70
|
+
/** Runs the handler in a workflow access scope: no user, and data calls allowed. */
|
|
71
|
+
export declare function runWorkflow(workflow: Workflow, rawInput: unknown): Promise<WorkflowRunResult>;
|
|
72
|
+
export type LoadedWorkflow = {
|
|
73
|
+
id: string;
|
|
74
|
+
file: string;
|
|
75
|
+
workflow: Workflow;
|
|
76
|
+
};
|
|
77
|
+
/** Every exported workflow in the app, by export name. */
|
|
78
|
+
export declare function loadWorkflows(modules?: Record<string, () => Promise<Record<string, unknown>>>): Promise<LoadedWorkflow[]>;
|
|
79
|
+
/** The input as the run log keeps it: a trigger's `seen` list can hold thousands of ids. */
|
|
80
|
+
export declare const loggedInput: (rawInput: unknown) => unknown;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Server-only: runs a workflow the host invoked. Takes the same platform input
|
|
2
|
+
// as classic triggered endpoints (`__cron`, `__poll`, `__webhook`), so the
|
|
3
|
+
// runner's schedules, polls and provider deliveries work unchanged.
|
|
4
|
+
import { errorOf } from "./runLog.js";
|
|
5
|
+
import { runInScope } from "./scope.js";
|
|
6
|
+
import { isWorkflow } from "./workflow.js";
|
|
7
|
+
import { workflowModules } from "./workflowModules.js";
|
|
8
|
+
const asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
9
|
+
const idOf = (id) => {
|
|
10
|
+
if (typeof id !== "string" && typeof id !== "number")
|
|
11
|
+
throw new TypeError(`trigger ids must be strings, got ${typeof id}`);
|
|
12
|
+
const value = String(id);
|
|
13
|
+
if (value.length === 0 || value.length > 512)
|
|
14
|
+
throw new TypeError("trigger ids must be 1 to 512 characters");
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Splits the platform's state out of the input. A poll or a provider delivery
|
|
19
|
+
* with a cursor gets `seen`, `handled` and `advance`. Handled ids are reported
|
|
20
|
+
* whether or not the run throws, so an item acted on is never acted on again;
|
|
21
|
+
* the staged cursor only on success. Only ids the incoming `seen` lacked are
|
|
22
|
+
* reported: billing reads an empty list as a run that found nothing new.
|
|
23
|
+
*/
|
|
24
|
+
export function triggerContext(workflow, rawInput) {
|
|
25
|
+
const raw = asRecord(rawInput);
|
|
26
|
+
const { __cron, __poll, __webhook, ...input } = raw ?? {};
|
|
27
|
+
const declared = workflow.config.trigger;
|
|
28
|
+
if (!declared)
|
|
29
|
+
return { input: raw ? input : rawInput };
|
|
30
|
+
const poll = asRecord(__poll);
|
|
31
|
+
const webhook = asRecord(__webhook);
|
|
32
|
+
const delivery = typeof webhook?.provider === "string" ? webhook : null;
|
|
33
|
+
// A run with no trigger state, such as a manual one, still gets a trigger: an empty one.
|
|
34
|
+
const info = delivery
|
|
35
|
+
? {
|
|
36
|
+
headers: asRecord(delivery.headers) ?? {},
|
|
37
|
+
...(typeof delivery.deliveryId === "string" ? { deliveryId: delivery.deliveryId } : {}),
|
|
38
|
+
provider: delivery.provider,
|
|
39
|
+
}
|
|
40
|
+
: declared.every
|
|
41
|
+
? {}
|
|
42
|
+
: { headers: {} };
|
|
43
|
+
if (!poll && declared.events)
|
|
44
|
+
return { input, trigger: info };
|
|
45
|
+
const state = poll ?? delivery ?? {};
|
|
46
|
+
const known = new Set(Array.isArray(state.seen) ? state.seen.map(String) : []);
|
|
47
|
+
const handled = [];
|
|
48
|
+
let staged;
|
|
49
|
+
const trigger = {
|
|
50
|
+
cursor: typeof state.cursor === "string" ? state.cursor : null,
|
|
51
|
+
seen: (id) => known.has(String(id)),
|
|
52
|
+
handled: (id) => {
|
|
53
|
+
const value = idOf(id);
|
|
54
|
+
if (known.has(value))
|
|
55
|
+
return;
|
|
56
|
+
known.add(value);
|
|
57
|
+
handled.push(value);
|
|
58
|
+
},
|
|
59
|
+
advance: (cursor) => {
|
|
60
|
+
if (typeof cursor !== "string" || cursor.length > 4096) {
|
|
61
|
+
throw new TypeError("trigger.advance takes a string of at most 4096 characters");
|
|
62
|
+
}
|
|
63
|
+
staged = cursor;
|
|
64
|
+
},
|
|
65
|
+
...info,
|
|
66
|
+
};
|
|
67
|
+
const report = (succeeded) => ({
|
|
68
|
+
handled: handled.slice(-2000),
|
|
69
|
+
...(succeeded && staged !== undefined ? { cursor: staged } : {}),
|
|
70
|
+
});
|
|
71
|
+
return { input, trigger, report };
|
|
72
|
+
}
|
|
73
|
+
/** Runs the handler in a workflow access scope: no user, and data calls allowed. */
|
|
74
|
+
export async function runWorkflow(workflow, rawInput) {
|
|
75
|
+
const { input, trigger, report } = triggerContext(workflow, rawInput);
|
|
76
|
+
const args = { input, ...(trigger ? { trigger } : {}) };
|
|
77
|
+
try {
|
|
78
|
+
const output = await runInScope({ kind: "workflow", user: null }, () => workflow.handler(args));
|
|
79
|
+
return { ok: true, output, ...(report ? { trigger: report(true) } : {}) };
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return { ok: false, error: errorOf(error), ...(report ? { trigger: report(false) } : {}) };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Every exported workflow in the app, by export name. */
|
|
86
|
+
export async function loadWorkflows(modules = workflowModules) {
|
|
87
|
+
const found = [];
|
|
88
|
+
for (const [file, load] of Object.entries(modules)) {
|
|
89
|
+
for (const [id, value] of Object.entries(await load()))
|
|
90
|
+
if (isWorkflow(value))
|
|
91
|
+
found.push({ id, file, workflow: value });
|
|
92
|
+
}
|
|
93
|
+
return found;
|
|
94
|
+
}
|
|
95
|
+
/** The input as the run log keeps it: a trigger's `seen` list can hold thousands of ids. */
|
|
96
|
+
export const loggedInput = (rawInput) => {
|
|
97
|
+
const raw = asRecord(rawInput);
|
|
98
|
+
if (!raw)
|
|
99
|
+
return rawInput;
|
|
100
|
+
const out = { ...raw };
|
|
101
|
+
for (const key of ["__poll", "__webhook"]) {
|
|
102
|
+
const state = asRecord(raw[key]);
|
|
103
|
+
if (state && Array.isArray(state.seen))
|
|
104
|
+
out[key] = { ...state, seen: `[${state.seen.length} ids]` };
|
|
105
|
+
}
|
|
106
|
+
return out;
|
|
107
|
+
};
|
package/package.json
CHANGED
package/dist/cjs/meta/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
package/dist/cjs/meta/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,25 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
package/dist/esm/meta/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
package/dist/esm/meta/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|