@domino-sdk/relay 1.0.0-next.8 → 1.0.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/README.md +1 -1
- package/dist/activity-DeKJsRry.d.ts +9112 -0
- package/dist/authoring.d.ts +1135 -285
- package/dist/authoring.js +545 -269
- package/dist/automatic-outcomes-B1xrETxm.d.ts +758 -0
- package/dist/avatar.d.ts +2 -2
- package/dist/browser-DFe7sWSN.d.ts +4154 -0
- package/dist/browser.d.ts +11 -2528
- package/dist/browser.js +8 -6
- package/dist/capability-error-DNMwKmlL.d.ts +458 -0
- package/dist/{chunk-V7EZUZ3Z.js → chunk-36HTX2BM.js} +389 -169
- package/dist/chunk-6QJ3LADK.js +112 -0
- package/dist/{chunk-77H7APVD.js → chunk-BGGKNIRP.js} +1 -1
- package/dist/chunk-EYH5RDIE.js +496 -0
- package/dist/chunk-GQKYAQM6.js +84 -0
- package/dist/chunk-GUP7YRR4.js +42 -0
- package/dist/{chunk-V5R2DMGY.js → chunk-GZ6FJAXN.js} +380 -128
- package/dist/chunk-JON5SESL.js +2986 -0
- package/dist/chunk-MC6V6VMG.js +49 -0
- package/dist/chunk-NPGENI7K.js +37 -0
- package/dist/chunk-VFHHLN6A.js +284 -0
- package/dist/chunk-WJSSJ7AF.js +151 -0
- package/dist/{chunk-QBOHLT7M.js → chunk-XFMSUPNS.js} +1 -1
- package/dist/{chunk-6A6K5RUD.js → chunk-ZVIRG24J.js} +145 -42
- package/dist/{client-CK4nwt7V.d.ts → client-XiuFnug_.d.ts} +2193 -562
- package/dist/{submission-input-C9qm9ixd.d.ts → groups-Ck-OxzjD.d.ts} +919 -1142
- package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
- package/dist/{images--vZ9U0kr.d.ts → images-Dv-P5VBw.d.ts} +2 -2
- package/dist/index.d.ts +13 -9
- package/dist/index.js +17 -6
- package/dist/internal.d.ts +82 -43
- package/dist/internal.js +58 -90
- package/dist/offers-Cy-e4o5x.d.ts +431 -0
- package/dist/{pages-BzqJuI69.d.ts → outcomes-kVB-Juzs.d.ts} +2386 -1490
- package/dist/pages-BBYD21IE.d.ts +359 -0
- package/dist/participant-rewards-3duLb8YJ.d.ts +668 -0
- package/dist/portal-proxy.js +22 -4
- package/dist/{profiles-DDMFBRKe.d.ts → profiles-D2aFcOxu.d.ts} +15 -15
- package/dist/react/index.d.ts +3122 -1011
- package/dist/react/index.js +1627 -779
- package/dist/request-error-DWduJCGV.d.ts +62 -0
- package/dist/schema-DfJzH2ci.d.ts +5644 -0
- package/dist/schema.d.ts +15 -4216
- package/dist/schema.js +322 -81
- package/dist/server/index.d.ts +81498 -0
- package/dist/server/index.js +2520 -0
- package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
- package/dist/submission-input-BZkm6ohU.d.ts +290 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -0
- package/dist/{wallet-BGOfFkG9.d.ts → wallet-YssWxGg8.d.ts} +35 -38
- package/package.json +8 -2
- package/dist/chunk-MRIURJE3.js +0 -257
- package/dist/chunk-VARGF4JS.js +0 -1733
- package/dist/chunk-ZWY3R6B3.js +0 -26
- package/dist/collection-BGneJ6Bk.d.ts +0 -114
- package/dist/integrations-C3Sp558f.d.ts +0 -1297
- package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
- package/dist/schema-pnuWqvGn.d.ts +0 -3396
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/capability-error.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var capabilityErrorCodes = [
|
|
4
|
+
"not-linked",
|
|
5
|
+
"provider-unavailable",
|
|
6
|
+
"author-error"
|
|
7
|
+
];
|
|
8
|
+
var isKnown = (code) => capabilityErrorCodes.includes(code);
|
|
9
|
+
var capabilityFailureSchema = z.looseObject({
|
|
10
|
+
code: z.string().min(1),
|
|
11
|
+
message: z.string().min(1),
|
|
12
|
+
/**
|
|
13
|
+
* True when Relay retries the attempt if the error reaches it uncaught, and calls the provider
|
|
14
|
+
* again. A failure that is not retryable is captured (or follows from the attempt's pinned
|
|
15
|
+
* inputs), so every run of the attempt sees it again. A retryable failure that quest code
|
|
16
|
+
* handles and moves past is final for the attempt; one that escapes the evaluation is retried.
|
|
17
|
+
*/
|
|
18
|
+
retryable: z.boolean()
|
|
19
|
+
});
|
|
20
|
+
var brand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay/CapabilityError");
|
|
21
|
+
var CapabilityError = class _CapabilityError extends Error {
|
|
22
|
+
code;
|
|
23
|
+
retryable;
|
|
24
|
+
constructor(code, message, options = {}) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "CapabilityError";
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.retryable = options.retryable ?? code === "provider-unavailable";
|
|
29
|
+
Object.defineProperty(this, brand, { value: true });
|
|
30
|
+
}
|
|
31
|
+
static [Symbol.hasInstance](value) {
|
|
32
|
+
return typeof value === "object" && value !== null && value[brand] === true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The error for a captured or transported failure. A code this SDK does not know is never
|
|
36
|
+
* retryable: nothing tells it a retry would help.
|
|
37
|
+
*/
|
|
38
|
+
static from(failure) {
|
|
39
|
+
return new _CapabilityError(failure.code, failure.message, {
|
|
40
|
+
retryable: isKnown(failure.code) && failure.retryable
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
capabilityErrorCodes,
|
|
47
|
+
capabilityFailureSchema,
|
|
48
|
+
CapabilityError
|
|
49
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/request-error.ts
|
|
2
|
+
var requestErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RequestError");
|
|
3
|
+
function isRequestError(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && value[requestErrorBrand] === true;
|
|
5
|
+
}
|
|
6
|
+
var RequestError = class extends Error {
|
|
7
|
+
name = "RequestError";
|
|
8
|
+
[requestErrorBrand] = true;
|
|
9
|
+
kind;
|
|
10
|
+
uncertain;
|
|
11
|
+
status;
|
|
12
|
+
code;
|
|
13
|
+
operationId;
|
|
14
|
+
/** `replay` for a replay-safe operation ID, else `reconcile`; only when `uncertain`. */
|
|
15
|
+
recovery;
|
|
16
|
+
/**
|
|
17
|
+
* Milliseconds the server asked the client to wait before trying again, from the `Retry-After`
|
|
18
|
+
* header of an error answer such as a 429 or 503. The client's own retries never wait past the
|
|
19
|
+
* call's deadline, so a longer wait is left to the caller.
|
|
20
|
+
*/
|
|
21
|
+
retryAfter;
|
|
22
|
+
constructor(message, details) {
|
|
23
|
+
super(message, details.cause === void 0 ? {} : { cause: details.cause });
|
|
24
|
+
this.kind = details.kind;
|
|
25
|
+
this.uncertain = details.uncertain ?? false;
|
|
26
|
+
this.status = details.status;
|
|
27
|
+
this.code = details.code;
|
|
28
|
+
this.operationId = details.operationId;
|
|
29
|
+
this.retryAfter = details.retryAfter;
|
|
30
|
+
this.recovery = this.uncertain ? details.operationId && (details.replaySafe ?? true) ? "replay" : "reconcile" : void 0;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
isRequestError,
|
|
36
|
+
RequestError
|
|
37
|
+
};
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import {
|
|
2
|
+
imageAssetArtifactSchema,
|
|
3
|
+
publishedImageSchema
|
|
4
|
+
} from "./chunk-BGGKNIRP.js";
|
|
5
|
+
import {
|
|
6
|
+
catalogDeploymentSchema,
|
|
7
|
+
interactionSchema,
|
|
8
|
+
questCollectionSchema,
|
|
9
|
+
questTypeVersionSchema
|
|
10
|
+
} from "./chunk-EYH5RDIE.js";
|
|
11
|
+
import {
|
|
12
|
+
engagementArtifactSchema,
|
|
13
|
+
engagementDeploymentEntrySchema,
|
|
14
|
+
leaderboardArtifactSchema,
|
|
15
|
+
leaderboardPreviewSchema,
|
|
16
|
+
offerArtifactSchema,
|
|
17
|
+
offerDefinitionSchema,
|
|
18
|
+
pointLedgerArtifactSchema,
|
|
19
|
+
pointLedgerSchema,
|
|
20
|
+
publishedReferralSchema,
|
|
21
|
+
referralArtifactSchema
|
|
22
|
+
} from "./chunk-36HTX2BM.js";
|
|
23
|
+
import {
|
|
24
|
+
identifier,
|
|
25
|
+
pageCursorSchema,
|
|
26
|
+
projectCalendarDeclarationSchema,
|
|
27
|
+
publishedReleaseSchema,
|
|
28
|
+
publishedTrackerSchema,
|
|
29
|
+
questBudgetViewSchema,
|
|
30
|
+
releaseSchema,
|
|
31
|
+
rewardSchema,
|
|
32
|
+
timeZoneNameSchema,
|
|
33
|
+
trackerArtifactSchema
|
|
34
|
+
} from "./chunk-JON5SESL.js";
|
|
35
|
+
|
|
36
|
+
// src/deployments.ts
|
|
37
|
+
import { z } from "zod";
|
|
38
|
+
var projectCatalogArtifactSchema = catalogDeploymentSchema.omit({ expectedRevision: true }).extend({
|
|
39
|
+
engagement: z.array(engagementArtifactSchema).max(50).default([]),
|
|
40
|
+
trackers: z.array(trackerArtifactSchema).max(50).default([]),
|
|
41
|
+
pointLedgers: z.array(pointLedgerArtifactSchema).max(50).default([]),
|
|
42
|
+
offers: z.array(offerArtifactSchema).max(100).default([]),
|
|
43
|
+
referrals: z.array(referralArtifactSchema).max(50).default([]),
|
|
44
|
+
leaderboards: z.array(leaderboardArtifactSchema).max(50).default([]),
|
|
45
|
+
images: z.array(imageAssetArtifactSchema).max(10).default([]),
|
|
46
|
+
/** relay.json `calendar`: the project timezone. Omitted, the deployment leaves it unchanged. */
|
|
47
|
+
calendar: projectCalendarDeclarationSchema.optional()
|
|
48
|
+
});
|
|
49
|
+
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({ releases: z.array(releaseSchema).max(50).default([]) }).refine(
|
|
50
|
+
(value) => value.engagement.length > 0 || value.trackers.length > 0 || value.pointLedgers.length > 0 || value.offers.length > 0 || value.releases.length > 0 || value.leaderboards.length > 0 || value.referrals.length > 0 || value.images.length > 0 || value.types.length > 0 || value.collections.length > 0 || value.supportedInteractions !== void 0 || value.calendar !== void 0,
|
|
51
|
+
"No resources configured. Add engagement, trackers, quests, questTypes, pointLedgers, offers, leaderboards, referrals, images, collections, supportedInteractions, or calendar to relay.json."
|
|
52
|
+
);
|
|
53
|
+
var deploymentPreviewSchema = z.object({
|
|
54
|
+
id: identifier,
|
|
55
|
+
engagement: z.array(engagementDeploymentEntrySchema).default([]),
|
|
56
|
+
trackers: z.array(publishedTrackerSchema).default([]),
|
|
57
|
+
baseRevision: z.number().int().nonnegative(),
|
|
58
|
+
pointLedgers: z.array(pointLedgerSchema).default([]),
|
|
59
|
+
offers: z.array(offerDefinitionSchema).default([]),
|
|
60
|
+
releases: z.array(publishedReleaseSchema),
|
|
61
|
+
types: z.array(questTypeVersionSchema),
|
|
62
|
+
collections: z.array(questCollectionSchema),
|
|
63
|
+
supportedInteractions: z.array(interactionSchema),
|
|
64
|
+
referrals: z.array(publishedReferralSchema).default([]),
|
|
65
|
+
leaderboards: z.array(leaderboardPreviewSchema).default([]),
|
|
66
|
+
images: z.array(publishedImageSchema).default([]),
|
|
67
|
+
/**
|
|
68
|
+
* The project timezone change this deployment makes, or null for none. A declared timezone
|
|
69
|
+
* applies only when relay.json changes it, so a change made in Console stays until relay.json
|
|
70
|
+
* changes. `effectiveAt` is when a scheduled change takes effect; null means the deployment keeps
|
|
71
|
+
* `timeZone` and cancels a pending change. Publishing makes exactly this change, or fails when the
|
|
72
|
+
* calendar moved since the preview (such as past a day boundary).
|
|
73
|
+
*/
|
|
74
|
+
calendar: z.object({
|
|
75
|
+
timeZone: timeZoneNameSchema,
|
|
76
|
+
effectiveAt: z.number().int().nullable()
|
|
77
|
+
}).nullable().default(null)
|
|
78
|
+
});
|
|
79
|
+
var publishDeploymentSchema = z.object({ id: identifier }).strict();
|
|
80
|
+
var deploymentResultSchema = deploymentPreviewSchema.extend({
|
|
81
|
+
revision: z.number().int().positive()
|
|
82
|
+
});
|
|
83
|
+
var deploymentSourceSchema = z.discriminatedUnion("kind", [
|
|
84
|
+
z.object({ kind: z.literal("direct") }).strict(),
|
|
85
|
+
z.object({ kind: z.literal("promotion"), deployment: identifier }).strict(),
|
|
86
|
+
z.object({ kind: z.literal("rollback"), deployment: identifier }).strict()
|
|
87
|
+
]);
|
|
88
|
+
var deploymentRecordMetadata = {
|
|
89
|
+
source: deploymentSourceSchema,
|
|
90
|
+
createdAt: z.number().int().nonnegative(),
|
|
91
|
+
createdBy: z.string().nullable()
|
|
92
|
+
};
|
|
93
|
+
var submittedDeploymentMetadata = {
|
|
94
|
+
submittedAt: z.number().int().nonnegative(),
|
|
95
|
+
submittedBy: z.string().nullable()
|
|
96
|
+
};
|
|
97
|
+
var deploymentRecordSchema = z.discriminatedUnion("status", [
|
|
98
|
+
deploymentPreviewSchema.extend({
|
|
99
|
+
...deploymentRecordMetadata,
|
|
100
|
+
status: z.literal("preview")
|
|
101
|
+
}),
|
|
102
|
+
deploymentPreviewSchema.extend({
|
|
103
|
+
...deploymentRecordMetadata,
|
|
104
|
+
...submittedDeploymentMetadata,
|
|
105
|
+
status: z.literal("pending")
|
|
106
|
+
}),
|
|
107
|
+
deploymentPreviewSchema.extend({
|
|
108
|
+
...deploymentRecordMetadata,
|
|
109
|
+
...submittedDeploymentMetadata,
|
|
110
|
+
status: z.literal("rejected"),
|
|
111
|
+
decidedAt: z.number().int().nonnegative(),
|
|
112
|
+
decidedBy: z.string().nullable(),
|
|
113
|
+
reason: z.string().trim().min(1).max(1e3)
|
|
114
|
+
}),
|
|
115
|
+
deploymentResultSchema.extend({
|
|
116
|
+
...deploymentRecordMetadata,
|
|
117
|
+
status: z.literal("published"),
|
|
118
|
+
submittedAt: z.number().int().nonnegative().nullable(),
|
|
119
|
+
submittedBy: z.string().nullable(),
|
|
120
|
+
publishedAt: z.number().int().nonnegative(),
|
|
121
|
+
publishedBy: z.string().nullable()
|
|
122
|
+
})
|
|
123
|
+
]);
|
|
124
|
+
var submitDeploymentSchema = z.object({ id: identifier }).strict();
|
|
125
|
+
var rejectDeploymentSchema = z.object({
|
|
126
|
+
id: identifier,
|
|
127
|
+
reason: z.string().trim().min(1).max(1e3)
|
|
128
|
+
}).strict();
|
|
129
|
+
var repeatableDeploymentSchema = z.object({ actionId: z.string().uuid(), id: identifier }).strict();
|
|
130
|
+
var promoteDeploymentSchema = repeatableDeploymentSchema;
|
|
131
|
+
var rollbackDeploymentSchema = repeatableDeploymentSchema;
|
|
132
|
+
|
|
133
|
+
// src/activity.ts
|
|
134
|
+
import { z as z2 } from "zod";
|
|
135
|
+
var activityTypes = {
|
|
136
|
+
attemptRejected: "attempt.rejected",
|
|
137
|
+
entitlementGranted: "entitlement.granted",
|
|
138
|
+
rewardDeliveryUpdated: "reward.delivery.updated",
|
|
139
|
+
completionCreated: "completion.created",
|
|
140
|
+
pointsAwarded: "points.awarded",
|
|
141
|
+
reviewPending: "review.pending",
|
|
142
|
+
rewardDeliveryFailed: "reward.delivery.failed",
|
|
143
|
+
entitlementCollected: "entitlement.collected",
|
|
144
|
+
referralQualified: "referral.qualified"
|
|
145
|
+
};
|
|
146
|
+
var activityTypeSchema = z2.string().min(1).max(100);
|
|
147
|
+
|
|
148
|
+
// src/automatic-outcomes.ts
|
|
149
|
+
import { z as z3 } from "zod";
|
|
150
|
+
var automaticEventSchema = z3.discriminatedUnion("kind", [
|
|
151
|
+
z3.object({
|
|
152
|
+
kind: z3.literal("completion"),
|
|
153
|
+
attempt: identifier,
|
|
154
|
+
generation: z3.number().int().nonnegative()
|
|
155
|
+
}),
|
|
156
|
+
z3.object({ kind: z3.literal("points"), entry: identifier }),
|
|
157
|
+
z3.object({ kind: z3.literal("group"), action: identifier }),
|
|
158
|
+
z3.object({ kind: z3.literal("campaign"), action: identifier }),
|
|
159
|
+
z3.object({ kind: z3.literal("publication"), revision: identifier }),
|
|
160
|
+
z3.object({ kind: z3.literal("revocation"), action: identifier })
|
|
161
|
+
]);
|
|
162
|
+
var knownEventKinds = new Set(
|
|
163
|
+
automaticEventSchema.options.map((option) => option.shape.kind.value)
|
|
164
|
+
);
|
|
165
|
+
var automaticEventResponseSchema = z3.union([
|
|
166
|
+
automaticEventSchema,
|
|
167
|
+
z3.looseObject({
|
|
168
|
+
kind: z3.string().refine((kind) => !knownEventKinds.has(kind))
|
|
169
|
+
}).catchall(z3.json())
|
|
170
|
+
]);
|
|
171
|
+
var automaticOutcomeSchema = z3.object({
|
|
172
|
+
id: identifier,
|
|
173
|
+
quest: identifier,
|
|
174
|
+
member: identifier,
|
|
175
|
+
release: identifier,
|
|
176
|
+
event: automaticEventResponseSchema,
|
|
177
|
+
state: z3.enum(["admitted", "skipped"]),
|
|
178
|
+
code: z3.string().nullable(),
|
|
179
|
+
reason: z3.string().nullable(),
|
|
180
|
+
attempt: identifier.nullable(),
|
|
181
|
+
revision: z3.number().int().nonnegative(),
|
|
182
|
+
createdAt: z3.number().int().safe(),
|
|
183
|
+
updatedAt: z3.number().int().safe()
|
|
184
|
+
});
|
|
185
|
+
var automaticOutcomeQuerySchema = z3.strictObject({
|
|
186
|
+
quest: identifier.optional(),
|
|
187
|
+
member: identifier.optional(),
|
|
188
|
+
state: z3.enum(["admitted", "skipped"]).optional(),
|
|
189
|
+
code: z3.string().max(100).optional(),
|
|
190
|
+
cursor: pageCursorSchema.optional()
|
|
191
|
+
});
|
|
192
|
+
var automaticOutcomePageSchema = z3.object({
|
|
193
|
+
items: z3.array(automaticOutcomeSchema),
|
|
194
|
+
nextCursor: pageCursorSchema.nullable()
|
|
195
|
+
});
|
|
196
|
+
var automaticCatchUpInputSchema = z3.strictObject({
|
|
197
|
+
quest: identifier,
|
|
198
|
+
outcomes: z3.array(identifier).min(1).max(50)
|
|
199
|
+
});
|
|
200
|
+
var automaticCatchUpPreviewSchema = z3.object({
|
|
201
|
+
quest: identifier,
|
|
202
|
+
release: identifier,
|
|
203
|
+
token: identifier,
|
|
204
|
+
items: z3.array(
|
|
205
|
+
z3.object({
|
|
206
|
+
outcome: automaticOutcomeSchema,
|
|
207
|
+
code: z3.string().nullable(),
|
|
208
|
+
reason: z3.string().nullable(),
|
|
209
|
+
attempt: identifier.nullable(),
|
|
210
|
+
wouldAdmit: z3.boolean(),
|
|
211
|
+
budgets: z3.array(questBudgetViewSchema)
|
|
212
|
+
})
|
|
213
|
+
),
|
|
214
|
+
/** Declared rewards per successful evaluation. Evaluators may choose different rewards. */
|
|
215
|
+
rewards: z3.array(rewardSchema),
|
|
216
|
+
/** Each budget's declared cost per successful evaluation; dynamic costs remain explicit. */
|
|
217
|
+
costs: z3.array(
|
|
218
|
+
z3.object({
|
|
219
|
+
budget: identifier,
|
|
220
|
+
cost: z3.union([z3.number(), z3.literal("dynamic")])
|
|
221
|
+
})
|
|
222
|
+
)
|
|
223
|
+
});
|
|
224
|
+
var automaticCatchUpConfirmSchema = automaticCatchUpInputSchema.extend(
|
|
225
|
+
{
|
|
226
|
+
actionId: identifier,
|
|
227
|
+
token: identifier,
|
|
228
|
+
reason: z3.string().trim().min(1).max(1e3)
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
var automaticCatchUpResultSchema = z3.object({
|
|
232
|
+
items: z3.array(automaticOutcomeSchema)
|
|
233
|
+
});
|
|
234
|
+
var automaticSchedulingQuerySchema = z3.strictObject({
|
|
235
|
+
member: identifier.optional(),
|
|
236
|
+
cursor: pageCursorSchema.optional()
|
|
237
|
+
});
|
|
238
|
+
var automaticSchedulingSchema = z3.object({
|
|
239
|
+
id: identifier,
|
|
240
|
+
member: identifier,
|
|
241
|
+
event: automaticEventResponseSchema,
|
|
242
|
+
state: z3.enum(["pending", "retrying", "failed"]),
|
|
243
|
+
attempts: z3.number().int().nonnegative(),
|
|
244
|
+
error: z3.string().nullable(),
|
|
245
|
+
createdAt: z3.number().int().safe(),
|
|
246
|
+
nextAttemptAt: z3.number().int().safe()
|
|
247
|
+
});
|
|
248
|
+
var automaticSchedulingPageSchema = z3.object({
|
|
249
|
+
items: z3.array(automaticSchedulingSchema),
|
|
250
|
+
nextCursor: pageCursorSchema.nullable()
|
|
251
|
+
});
|
|
252
|
+
var automaticSchedulingRetrySchema = z3.strictObject({
|
|
253
|
+
actionId: identifier,
|
|
254
|
+
id: identifier,
|
|
255
|
+
reason: z3.string().trim().min(1).max(1e3)
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
export {
|
|
259
|
+
projectCatalogArtifactSchema,
|
|
260
|
+
projectDeploymentSchema,
|
|
261
|
+
deploymentPreviewSchema,
|
|
262
|
+
publishDeploymentSchema,
|
|
263
|
+
deploymentResultSchema,
|
|
264
|
+
deploymentSourceSchema,
|
|
265
|
+
deploymentRecordSchema,
|
|
266
|
+
submitDeploymentSchema,
|
|
267
|
+
rejectDeploymentSchema,
|
|
268
|
+
promoteDeploymentSchema,
|
|
269
|
+
rollbackDeploymentSchema,
|
|
270
|
+
activityTypes,
|
|
271
|
+
activityTypeSchema,
|
|
272
|
+
automaticEventSchema,
|
|
273
|
+
automaticOutcomeSchema,
|
|
274
|
+
automaticOutcomeQuerySchema,
|
|
275
|
+
automaticOutcomePageSchema,
|
|
276
|
+
automaticCatchUpInputSchema,
|
|
277
|
+
automaticCatchUpPreviewSchema,
|
|
278
|
+
automaticCatchUpConfirmSchema,
|
|
279
|
+
automaticCatchUpResultSchema,
|
|
280
|
+
automaticSchedulingQuerySchema,
|
|
281
|
+
automaticSchedulingSchema,
|
|
282
|
+
automaticSchedulingPageSchema,
|
|
283
|
+
automaticSchedulingRetrySchema
|
|
284
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
imageComparisonSchema,
|
|
3
|
+
imageExtractionSchema,
|
|
4
|
+
imageFieldsSchema,
|
|
5
|
+
imageInspectionSchema,
|
|
6
|
+
imageSightingsSchema
|
|
7
|
+
} from "./chunk-BGGKNIRP.js";
|
|
8
|
+
import {
|
|
9
|
+
authScopeSchema
|
|
10
|
+
} from "./chunk-XFMSUPNS.js";
|
|
11
|
+
import {
|
|
12
|
+
appIdentityKindSchema,
|
|
13
|
+
openIdentityKindSchema,
|
|
14
|
+
photoResultSchema
|
|
15
|
+
} from "./chunk-JON5SESL.js";
|
|
16
|
+
|
|
17
|
+
// src/configuration.ts
|
|
18
|
+
function questConfiguration(release) {
|
|
19
|
+
return release.configuration ?? {
|
|
20
|
+
defaults: Object.fromEntries(
|
|
21
|
+
Object.entries(release.fields).map(([key, field]) => [
|
|
22
|
+
key,
|
|
23
|
+
field.default
|
|
24
|
+
])
|
|
25
|
+
),
|
|
26
|
+
overrides: { ...release.values },
|
|
27
|
+
preserved: Object.keys(release.values)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/identity-integration.ts
|
|
32
|
+
import { z } from "zod";
|
|
33
|
+
var identityIntegrationInputSchema = z.object({
|
|
34
|
+
name: z.string().trim().min(1).max(80),
|
|
35
|
+
origin: z.string().url().refine((value) => {
|
|
36
|
+
const url = new URL(value);
|
|
37
|
+
return url.protocol === "https:" && url.origin === value;
|
|
38
|
+
}, "Use an exact HTTPS application origin"),
|
|
39
|
+
/**
|
|
40
|
+
* The identity kind this integration owns in the project and environment, such as
|
|
41
|
+
* `app:telegram`. Each member it signs in gets the exchanged subject as an identity of this
|
|
42
|
+
* kind, which tracker attribution and `ctx.member.identities()` read. Its kind cannot change.
|
|
43
|
+
* Omit it for an integration that only signs members in.
|
|
44
|
+
*
|
|
45
|
+
* A kind belongs to the integration that first claimed it, also after that integration is
|
|
46
|
+
* disconnected. A new integration takes a kind that already has identities only by adopting
|
|
47
|
+
* them with `adoptIdentitiesFrom`.
|
|
48
|
+
*/
|
|
49
|
+
identityKind: appIdentityKindSchema.optional(),
|
|
50
|
+
/**
|
|
51
|
+
* Adopt the identities of a disconnected integration's `identityKind`: its ID, as
|
|
52
|
+
* `identityIntegrations.kinds()` lists it. Adopt only when this app's user IDs mean the same
|
|
53
|
+
* users as that integration's, because each one then signs in as the member that ID is linked
|
|
54
|
+
* to. Needs `reason`, which the audit log keeps.
|
|
55
|
+
*/
|
|
56
|
+
adoptIdentitiesFrom: z.string().uuid().optional(),
|
|
57
|
+
/** Why the identities are adopted; required with `adoptIdentitiesFrom`. */
|
|
58
|
+
reason: z.string().trim().min(1).max(500).optional()
|
|
59
|
+
}).strict().refine(
|
|
60
|
+
(input) => !input.adoptIdentitiesFrom || input.identityKind,
|
|
61
|
+
"Adopting identities needs the identityKind they have"
|
|
62
|
+
).refine(
|
|
63
|
+
(input) => !input.adoptIdentitiesFrom === !input.reason,
|
|
64
|
+
"Give a reason when adopting identities, and only then"
|
|
65
|
+
);
|
|
66
|
+
var identityIntegrationSchema = z.object({
|
|
67
|
+
...authScopeSchema.shape,
|
|
68
|
+
id: z.string().uuid(),
|
|
69
|
+
name: z.string(),
|
|
70
|
+
origin: z.string(),
|
|
71
|
+
expiresAt: z.number(),
|
|
72
|
+
/** The identity kind the integration owns; null when it only signs members in. */
|
|
73
|
+
identityKind: openIdentityKindSchema.nullable().default(null)
|
|
74
|
+
});
|
|
75
|
+
var identityIntegrationSecretSchema = identityIntegrationSchema.extend(
|
|
76
|
+
{
|
|
77
|
+
token: z.string()
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
var identityKindClaimSchema = z.object({
|
|
81
|
+
kind: openIdentityKindSchema,
|
|
82
|
+
/** The owning integration's ID; it stays after the integration is disconnected. */
|
|
83
|
+
integration: z.string(),
|
|
84
|
+
/** The owning integration's name when it claimed or adopted the kind. */
|
|
85
|
+
integrationName: z.string(),
|
|
86
|
+
/** Whether the owning integration is still connected. */
|
|
87
|
+
connected: z.boolean(),
|
|
88
|
+
/** Linked identities of the kind; adopting them is required to reuse the kind. */
|
|
89
|
+
linked: z.number().int().nonnegative(),
|
|
90
|
+
/** Identities an operator unlinked. */
|
|
91
|
+
unlinked: z.number().int().nonnegative(),
|
|
92
|
+
claimedAt: z.number().int().nonnegative()
|
|
93
|
+
});
|
|
94
|
+
var participantExchangeSchema = z.object({
|
|
95
|
+
subject: z.string().min(1).max(200),
|
|
96
|
+
previousToken: z.string().max(200).optional()
|
|
97
|
+
}).strict();
|
|
98
|
+
|
|
99
|
+
// src/image-results.ts
|
|
100
|
+
import { z as z2 } from "zod";
|
|
101
|
+
var invalid = (message, path) => new z2.ZodError([{ code: "custom", message, path, input: void 0 }]);
|
|
102
|
+
function parseImageExtraction(raw, value) {
|
|
103
|
+
const result = imageExtractionSchema.parse(value);
|
|
104
|
+
const fields = imageFieldsSchema.parse(raw);
|
|
105
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
106
|
+
const extracted = result.values[key];
|
|
107
|
+
if (extracted === void 0) {
|
|
108
|
+
throw invalid("Image extraction omitted " + key, ["values", key]);
|
|
109
|
+
}
|
|
110
|
+
if (extracted !== null && typeof extracted !== field.type) {
|
|
111
|
+
throw invalid("Image extraction returned the wrong type for " + key, [
|
|
112
|
+
"values",
|
|
113
|
+
key
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (Object.keys(result.values).some((key) => !Object.hasOwn(fields, key))) {
|
|
118
|
+
throw invalid("Image extraction returned an undeclared field", ["values"]);
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
function parseImageResult(request, value) {
|
|
123
|
+
switch (request.operation) {
|
|
124
|
+
case "inspect":
|
|
125
|
+
return imageInspectionSchema.parse(value);
|
|
126
|
+
case "compare":
|
|
127
|
+
return imageComparisonSchema.parse(value);
|
|
128
|
+
case "review":
|
|
129
|
+
return photoResultSchema.parse(value);
|
|
130
|
+
case "extract":
|
|
131
|
+
return parseImageExtraction(request.fields, value);
|
|
132
|
+
case "seen":
|
|
133
|
+
return imageSightingsSchema.parse(value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/sequence-cursor.ts
|
|
138
|
+
import { z as z3 } from "zod";
|
|
139
|
+
var sequenceCursorSchema = z3.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z3.number().int().positive().safe());
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
questConfiguration,
|
|
143
|
+
identityIntegrationInputSchema,
|
|
144
|
+
identityIntegrationSchema,
|
|
145
|
+
identityIntegrationSecretSchema,
|
|
146
|
+
identityKindClaimSchema,
|
|
147
|
+
participantExchangeSchema,
|
|
148
|
+
parseImageExtraction,
|
|
149
|
+
parseImageResult,
|
|
150
|
+
sequenceCursorSchema
|
|
151
|
+
};
|