@oomol-lab/open-flow 0.1.0-beta.20 → 0.1.0-beta.21
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/browser/{createResourceDialog-DlrAMxmo.js → createResourceDialog-CjuJryCv.js} +13 -13
- package/dist/browser/{flowChanges-jX3KYcb0.js → flowChanges-Tg1duLry.js} +2269 -2208
- package/dist/browser/{flowWorkspace-BIYwslVl.js → flowWorkspace-CoK10XHY.js} +306 -306
- package/dist/browser/{inputValues-BWfRHJWC.js → inputValues-CDiBMKu8.js} +1 -1
- package/dist/browser/workbench.js +23 -23
- package/dist/browser/{workbenchSelect-CwP6rphY.js → workbenchSelect-DEmv7SLW.js} +1 -1
- package/dist/common/control-api-conformance.js +871 -810
- package/dist/common/control-api.js +249 -188
- package/dist/common/flow-encoding.d.ts +6 -0
- package/dist/common/flow-encoding.js +1323 -1171
- package/dist/common/flow-semantics.js +1872 -1811
- package/dist/common/mcp.js +176 -115
- package/dist/common/provider-triggers.js +1307 -1246
- package/package.json +1 -1
|
@@ -4145,55 +4145,55 @@ var M = /*@__PURE__*/ S("ZodType", (e, t) => (ds(), E.init(e, t), e.def = t, e.t
|
|
|
4145
4145
|
return e.add(this, t), this;
|
|
4146
4146
|
},
|
|
4147
4147
|
refine(e, t) {
|
|
4148
|
-
return this.check(
|
|
4148
|
+
return this.check(Ec(e, t));
|
|
4149
4149
|
},
|
|
4150
4150
|
superRefine(e, t) {
|
|
4151
|
-
return this.check(
|
|
4151
|
+
return this.check(Dc(e, t));
|
|
4152
4152
|
},
|
|
4153
4153
|
overwrite(e) {
|
|
4154
4154
|
return this.check(/* @__PURE__ */ Xa(e));
|
|
4155
4155
|
},
|
|
4156
4156
|
optional() {
|
|
4157
|
-
return
|
|
4157
|
+
return oc(this);
|
|
4158
4158
|
},
|
|
4159
4159
|
exactOptional() {
|
|
4160
|
-
return
|
|
4160
|
+
return cc(this);
|
|
4161
4161
|
},
|
|
4162
4162
|
nullable() {
|
|
4163
|
-
return
|
|
4163
|
+
return uc(this);
|
|
4164
4164
|
},
|
|
4165
4165
|
nullish() {
|
|
4166
|
-
return
|
|
4166
|
+
return oc(uc(this));
|
|
4167
4167
|
},
|
|
4168
4168
|
nonoptional(e) {
|
|
4169
|
-
return
|
|
4169
|
+
return gc(this, e);
|
|
4170
4170
|
},
|
|
4171
4171
|
array() {
|
|
4172
|
-
return
|
|
4172
|
+
return R(this);
|
|
4173
4173
|
},
|
|
4174
4174
|
or(e) {
|
|
4175
|
-
return
|
|
4175
|
+
return B([this, e]);
|
|
4176
4176
|
},
|
|
4177
4177
|
and(e) {
|
|
4178
|
-
return
|
|
4178
|
+
return Zs(this, e);
|
|
4179
4179
|
},
|
|
4180
4180
|
transform(e) {
|
|
4181
|
-
return
|
|
4181
|
+
return bc(this, ic(e));
|
|
4182
4182
|
},
|
|
4183
4183
|
default(e) {
|
|
4184
|
-
return
|
|
4184
|
+
return fc(this, e);
|
|
4185
4185
|
},
|
|
4186
4186
|
prefault(e) {
|
|
4187
|
-
return
|
|
4187
|
+
return mc(this, e);
|
|
4188
4188
|
},
|
|
4189
4189
|
catch(e) {
|
|
4190
|
-
return
|
|
4190
|
+
return vc(this, e);
|
|
4191
4191
|
},
|
|
4192
4192
|
pipe(e) {
|
|
4193
|
-
return
|
|
4193
|
+
return bc(this, e);
|
|
4194
4194
|
},
|
|
4195
4195
|
readonly() {
|
|
4196
|
-
return
|
|
4196
|
+
return Sc(this);
|
|
4197
4197
|
},
|
|
4198
4198
|
describe(e) {
|
|
4199
4199
|
let t = this.clone();
|
|
@@ -4330,136 +4330,136 @@ var M = /*@__PURE__*/ S("ZodType", (e, t) => (ds(), E.init(e, t), e.def = t, e.t
|
|
|
4330
4330
|
fr.init(e, t), ps.init(e, t);
|
|
4331
4331
|
}, {
|
|
4332
4332
|
email(e) {
|
|
4333
|
-
return this.check(/* @__PURE__ */ ia(
|
|
4333
|
+
return this.check(/* @__PURE__ */ ia(ys, e));
|
|
4334
4334
|
},
|
|
4335
4335
|
url(e) {
|
|
4336
|
-
return this.check(/* @__PURE__ */ ua(
|
|
4336
|
+
return this.check(/* @__PURE__ */ ua(Ss, e));
|
|
4337
4337
|
},
|
|
4338
4338
|
jwt(e) {
|
|
4339
|
-
return this.check(/* @__PURE__ */ Ta(
|
|
4339
|
+
return this.check(/* @__PURE__ */ Ta(Ls, e));
|
|
4340
4340
|
},
|
|
4341
4341
|
emoji(e) {
|
|
4342
|
-
return this.check(/* @__PURE__ */ da(
|
|
4342
|
+
return this.check(/* @__PURE__ */ da(Cs, e));
|
|
4343
4343
|
},
|
|
4344
4344
|
guid(e) {
|
|
4345
|
-
return this.check(/* @__PURE__ */ aa(
|
|
4345
|
+
return this.check(/* @__PURE__ */ aa(bs, e));
|
|
4346
4346
|
},
|
|
4347
4347
|
uuid(e) {
|
|
4348
|
-
return this.check(/* @__PURE__ */ oa(
|
|
4348
|
+
return this.check(/* @__PURE__ */ oa(xs, e));
|
|
4349
4349
|
},
|
|
4350
4350
|
uuidv4(e) {
|
|
4351
|
-
return this.check(/* @__PURE__ */ sa(
|
|
4351
|
+
return this.check(/* @__PURE__ */ sa(xs, e));
|
|
4352
4352
|
},
|
|
4353
4353
|
uuidv6(e) {
|
|
4354
|
-
return this.check(/* @__PURE__ */ ca(
|
|
4354
|
+
return this.check(/* @__PURE__ */ ca(xs, e));
|
|
4355
4355
|
},
|
|
4356
4356
|
uuidv7(e) {
|
|
4357
|
-
return this.check(/* @__PURE__ */ la(
|
|
4357
|
+
return this.check(/* @__PURE__ */ la(xs, e));
|
|
4358
4358
|
},
|
|
4359
4359
|
nanoid(e) {
|
|
4360
|
-
return this.check(/* @__PURE__ */ fa(
|
|
4360
|
+
return this.check(/* @__PURE__ */ fa(ws, e));
|
|
4361
4361
|
},
|
|
4362
4362
|
cuid(e) {
|
|
4363
|
-
return this.check(/* @__PURE__ */ pa(
|
|
4363
|
+
return this.check(/* @__PURE__ */ pa(Ts, e));
|
|
4364
4364
|
},
|
|
4365
4365
|
cuid2(e) {
|
|
4366
|
-
return this.check(/* @__PURE__ */ ma(
|
|
4366
|
+
return this.check(/* @__PURE__ */ ma(Es, e));
|
|
4367
4367
|
},
|
|
4368
4368
|
ulid(e) {
|
|
4369
|
-
return this.check(/* @__PURE__ */ ha(
|
|
4369
|
+
return this.check(/* @__PURE__ */ ha(Ds, e));
|
|
4370
4370
|
},
|
|
4371
4371
|
base64(e) {
|
|
4372
|
-
return this.check(/* @__PURE__ */ Sa(
|
|
4372
|
+
return this.check(/* @__PURE__ */ Sa(Ps, e));
|
|
4373
4373
|
},
|
|
4374
4374
|
base64url(e) {
|
|
4375
|
-
return this.check(/* @__PURE__ */ Ca(
|
|
4375
|
+
return this.check(/* @__PURE__ */ Ca(Fs, e));
|
|
4376
4376
|
},
|
|
4377
4377
|
xid(e) {
|
|
4378
|
-
return this.check(/* @__PURE__ */ ga(
|
|
4378
|
+
return this.check(/* @__PURE__ */ ga(Os, e));
|
|
4379
4379
|
},
|
|
4380
4380
|
ksuid(e) {
|
|
4381
|
-
return this.check(/* @__PURE__ */ _a(
|
|
4381
|
+
return this.check(/* @__PURE__ */ _a(ks, e));
|
|
4382
4382
|
},
|
|
4383
4383
|
ipv4(e) {
|
|
4384
|
-
return this.check(/* @__PURE__ */ va(
|
|
4384
|
+
return this.check(/* @__PURE__ */ va(As, e));
|
|
4385
4385
|
},
|
|
4386
4386
|
ipv6(e) {
|
|
4387
|
-
return this.check(/* @__PURE__ */ ya(
|
|
4387
|
+
return this.check(/* @__PURE__ */ ya(js, e));
|
|
4388
4388
|
},
|
|
4389
4389
|
cidrv4(e) {
|
|
4390
|
-
return this.check(/* @__PURE__ */ ba(
|
|
4390
|
+
return this.check(/* @__PURE__ */ ba(Ms, e));
|
|
4391
4391
|
},
|
|
4392
4392
|
cidrv6(e) {
|
|
4393
|
-
return this.check(/* @__PURE__ */ xa(
|
|
4393
|
+
return this.check(/* @__PURE__ */ xa(Ns, e));
|
|
4394
4394
|
},
|
|
4395
4395
|
e164(e) {
|
|
4396
|
-
return this.check(/* @__PURE__ */ wa(
|
|
4396
|
+
return this.check(/* @__PURE__ */ wa(Is, e));
|
|
4397
4397
|
},
|
|
4398
4398
|
datetime(e) {
|
|
4399
|
-
return this.check(/* @__PURE__ */ Ea(
|
|
4399
|
+
return this.check(/* @__PURE__ */ Ea(hs, e));
|
|
4400
4400
|
},
|
|
4401
4401
|
date(e) {
|
|
4402
|
-
return this.check(/* @__PURE__ */ Da(
|
|
4402
|
+
return this.check(/* @__PURE__ */ Da(gs, e));
|
|
4403
4403
|
},
|
|
4404
4404
|
time(e) {
|
|
4405
|
-
return this.check(/* @__PURE__ */ Oa(
|
|
4405
|
+
return this.check(/* @__PURE__ */ Oa(_s, e));
|
|
4406
4406
|
},
|
|
4407
4407
|
duration(e) {
|
|
4408
|
-
return this.check(/* @__PURE__ */ ka(
|
|
4408
|
+
return this.check(/* @__PURE__ */ ka(vs, e));
|
|
4409
4409
|
}
|
|
4410
4410
|
});
|
|
4411
|
-
function
|
|
4411
|
+
function N(e) {
|
|
4412
4412
|
return /* @__PURE__ */ ra(ms, e);
|
|
4413
4413
|
}
|
|
4414
|
-
var
|
|
4414
|
+
var P = /*@__PURE__*/ S("ZodStringFormat", (e, t) => {
|
|
4415
4415
|
D.init(e, t), ps.init(e, t);
|
|
4416
|
-
}),
|
|
4417
|
-
kr.init(e, t),
|
|
4418
|
-
}),
|
|
4419
|
-
Ar.init(e, t),
|
|
4420
|
-
}),
|
|
4421
|
-
jr.init(e, t),
|
|
4422
|
-
}),
|
|
4423
|
-
Mr.init(e, t),
|
|
4424
|
-
}),
|
|
4425
|
-
hr.init(e, t),
|
|
4426
|
-
}),
|
|
4427
|
-
pr.init(e, t),
|
|
4428
|
-
}),
|
|
4429
|
-
mr.init(e, t),
|
|
4430
|
-
}),
|
|
4431
|
-
xr.init(e, t),
|
|
4432
|
-
}),
|
|
4433
|
-
Sr.init(e, t),
|
|
4434
|
-
}),
|
|
4435
|
-
Cr.init(e, t),
|
|
4436
|
-
}),
|
|
4437
|
-
wr.init(e, t),
|
|
4438
|
-
}),
|
|
4439
|
-
Tr.init(e, t),
|
|
4440
|
-
}),
|
|
4441
|
-
Er.init(e, t),
|
|
4442
|
-
}),
|
|
4443
|
-
Dr.init(e, t),
|
|
4444
|
-
}),
|
|
4445
|
-
Or.init(e, t),
|
|
4446
|
-
}),
|
|
4447
|
-
Nr.init(e, t),
|
|
4448
|
-
}),
|
|
4449
|
-
Ir.init(e, t),
|
|
4450
|
-
}),
|
|
4451
|
-
Lr.init(e, t),
|
|
4452
|
-
}),
|
|
4453
|
-
zr.init(e, t),
|
|
4454
|
-
}),
|
|
4455
|
-
Vr.init(e, t),
|
|
4456
|
-
}),
|
|
4457
|
-
Ur.init(e, t),
|
|
4458
|
-
}),
|
|
4459
|
-
Wr.init(e, t),
|
|
4460
|
-
}),
|
|
4461
|
-
Kr.init(e, t),
|
|
4462
|
-
}),
|
|
4416
|
+
}), hs = /*@__PURE__*/ S("ZodISODateTime", (e, t) => {
|
|
4417
|
+
kr.init(e, t), P.init(e, t);
|
|
4418
|
+
}), gs = /*@__PURE__*/ S("ZodISODate", (e, t) => {
|
|
4419
|
+
Ar.init(e, t), P.init(e, t);
|
|
4420
|
+
}), _s = /*@__PURE__*/ S("ZodISOTime", (e, t) => {
|
|
4421
|
+
jr.init(e, t), P.init(e, t);
|
|
4422
|
+
}), vs = /*@__PURE__*/ S("ZodISODuration", (e, t) => {
|
|
4423
|
+
Mr.init(e, t), P.init(e, t);
|
|
4424
|
+
}), ys = /*@__PURE__*/ S("ZodEmail", (e, t) => {
|
|
4425
|
+
hr.init(e, t), P.init(e, t);
|
|
4426
|
+
}), bs = /*@__PURE__*/ S("ZodGUID", (e, t) => {
|
|
4427
|
+
pr.init(e, t), P.init(e, t);
|
|
4428
|
+
}), xs = /*@__PURE__*/ S("ZodUUID", (e, t) => {
|
|
4429
|
+
mr.init(e, t), P.init(e, t);
|
|
4430
|
+
}), Ss = /*@__PURE__*/ S("ZodURL", (e, t) => {
|
|
4431
|
+
xr.init(e, t), P.init(e, t);
|
|
4432
|
+
}), Cs = /*@__PURE__*/ S("ZodEmoji", (e, t) => {
|
|
4433
|
+
Sr.init(e, t), P.init(e, t);
|
|
4434
|
+
}), ws = /*@__PURE__*/ S("ZodNanoID", (e, t) => {
|
|
4435
|
+
Cr.init(e, t), P.init(e, t);
|
|
4436
|
+
}), Ts = /*@__PURE__*/ S("ZodCUID", (e, t) => {
|
|
4437
|
+
wr.init(e, t), P.init(e, t);
|
|
4438
|
+
}), Es = /*@__PURE__*/ S("ZodCUID2", (e, t) => {
|
|
4439
|
+
Tr.init(e, t), P.init(e, t);
|
|
4440
|
+
}), Ds = /*@__PURE__*/ S("ZodULID", (e, t) => {
|
|
4441
|
+
Er.init(e, t), P.init(e, t);
|
|
4442
|
+
}), Os = /*@__PURE__*/ S("ZodXID", (e, t) => {
|
|
4443
|
+
Dr.init(e, t), P.init(e, t);
|
|
4444
|
+
}), ks = /*@__PURE__*/ S("ZodKSUID", (e, t) => {
|
|
4445
|
+
Or.init(e, t), P.init(e, t);
|
|
4446
|
+
}), As = /*@__PURE__*/ S("ZodIPv4", (e, t) => {
|
|
4447
|
+
Nr.init(e, t), P.init(e, t);
|
|
4448
|
+
}), js = /*@__PURE__*/ S("ZodIPv6", (e, t) => {
|
|
4449
|
+
Ir.init(e, t), P.init(e, t);
|
|
4450
|
+
}), Ms = /*@__PURE__*/ S("ZodCIDRv4", (e, t) => {
|
|
4451
|
+
Lr.init(e, t), P.init(e, t);
|
|
4452
|
+
}), Ns = /*@__PURE__*/ S("ZodCIDRv6", (e, t) => {
|
|
4453
|
+
zr.init(e, t), P.init(e, t);
|
|
4454
|
+
}), Ps = /*@__PURE__*/ S("ZodBase64", (e, t) => {
|
|
4455
|
+
Vr.init(e, t), P.init(e, t);
|
|
4456
|
+
}), Fs = /*@__PURE__*/ S("ZodBase64URL", (e, t) => {
|
|
4457
|
+
Ur.init(e, t), P.init(e, t);
|
|
4458
|
+
}), Is = /*@__PURE__*/ S("ZodE164", (e, t) => {
|
|
4459
|
+
Wr.init(e, t), P.init(e, t);
|
|
4460
|
+
}), Ls = /*@__PURE__*/ S("ZodJWT", (e, t) => {
|
|
4461
|
+
Kr.init(e, t), P.init(e, t);
|
|
4462
|
+
}), Rs = /*@__PURE__*/ S("ZodNumber", (e, t) => {
|
|
4463
4463
|
qr.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => So(e, t, n, r);
|
|
4464
4464
|
let n = e._zod.bag;
|
|
4465
4465
|
e.minValue = Math.max(n.minimum ?? -Infinity, n.exclusiveMinimum ?? -Infinity) ?? null, e.maxValue = Math.min(n.maximum ?? Infinity, n.exclusiveMaximum ?? Infinity) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? .5), e.isFinite = !0, e.format = n.format ?? null;
|
|
@@ -4483,10 +4483,10 @@ var N = /*@__PURE__*/ S("ZodStringFormat", (e, t) => {
|
|
|
4483
4483
|
return this.check(/* @__PURE__ */ La(e, t));
|
|
4484
4484
|
},
|
|
4485
4485
|
int(e) {
|
|
4486
|
-
return this.check(
|
|
4486
|
+
return this.check(Bs(e));
|
|
4487
4487
|
},
|
|
4488
4488
|
safe(e) {
|
|
4489
|
-
return this.check(
|
|
4489
|
+
return this.check(Bs(e));
|
|
4490
4490
|
},
|
|
4491
4491
|
positive(e) {
|
|
4492
4492
|
return this.check(/* @__PURE__ */ Ra(0, e));
|
|
@@ -4510,40 +4510,40 @@ var N = /*@__PURE__*/ S("ZodStringFormat", (e, t) => {
|
|
|
4510
4510
|
return this;
|
|
4511
4511
|
}
|
|
4512
4512
|
});
|
|
4513
|
-
function
|
|
4514
|
-
return /* @__PURE__ */ Aa(
|
|
4513
|
+
function F(e) {
|
|
4514
|
+
return /* @__PURE__ */ Aa(Rs, e);
|
|
4515
4515
|
}
|
|
4516
|
-
var
|
|
4517
|
-
Jr.init(e, t),
|
|
4516
|
+
var zs = /*@__PURE__*/ S("ZodNumberFormat", (e, t) => {
|
|
4517
|
+
Jr.init(e, t), Rs.init(e, t);
|
|
4518
4518
|
});
|
|
4519
|
-
function
|
|
4520
|
-
return /* @__PURE__ */ ja(
|
|
4519
|
+
function Bs(e) {
|
|
4520
|
+
return /* @__PURE__ */ ja(zs, e);
|
|
4521
4521
|
}
|
|
4522
|
-
var
|
|
4522
|
+
var Vs = /*@__PURE__*/ S("ZodBoolean", (e, t) => {
|
|
4523
4523
|
Yr.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Co(e, t, n, r);
|
|
4524
4524
|
});
|
|
4525
|
-
function
|
|
4526
|
-
return /* @__PURE__ */ Ma(
|
|
4525
|
+
function I(e) {
|
|
4526
|
+
return /* @__PURE__ */ Ma(Vs, e);
|
|
4527
4527
|
}
|
|
4528
|
-
var
|
|
4528
|
+
var Hs = /*@__PURE__*/ S("ZodNull", (e, t) => {
|
|
4529
4529
|
Xr.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => wo(e, t, n, r);
|
|
4530
4530
|
});
|
|
4531
|
-
function
|
|
4532
|
-
return /* @__PURE__ */ Na(
|
|
4531
|
+
function Us(e) {
|
|
4532
|
+
return /* @__PURE__ */ Na(Hs, e);
|
|
4533
4533
|
}
|
|
4534
|
-
var
|
|
4534
|
+
var Ws = /*@__PURE__*/ S("ZodUnknown", (e, t) => {
|
|
4535
4535
|
Zr.init(e, t), M.init(e, t), e._zod.processJSONSchema = (e, t, n) => void 0;
|
|
4536
4536
|
});
|
|
4537
|
-
function
|
|
4538
|
-
return /* @__PURE__ */ Pa(
|
|
4537
|
+
function L() {
|
|
4538
|
+
return /* @__PURE__ */ Pa(Ws);
|
|
4539
4539
|
}
|
|
4540
|
-
var
|
|
4540
|
+
var Gs = /*@__PURE__*/ S("ZodNever", (e, t) => {
|
|
4541
4541
|
Qr.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => To(e, t, n, r);
|
|
4542
4542
|
});
|
|
4543
|
-
function
|
|
4544
|
-
return /* @__PURE__ */ Fa(
|
|
4543
|
+
function Ks(e) {
|
|
4544
|
+
return /* @__PURE__ */ Fa(Gs, e);
|
|
4545
4545
|
}
|
|
4546
|
-
var
|
|
4546
|
+
var qs = /*@__PURE__*/ S("ZodArray", (e, t) => {
|
|
4547
4547
|
fs(), ei.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ao(e, t, n, r), e.element = t.element;
|
|
4548
4548
|
}, {
|
|
4549
4549
|
min(e, t) {
|
|
@@ -4562,14 +4562,14 @@ var Ys = /*@__PURE__*/ S("ZodArray", (e, t) => {
|
|
|
4562
4562
|
return this.element;
|
|
4563
4563
|
}
|
|
4564
4564
|
});
|
|
4565
|
-
function
|
|
4566
|
-
return /* @__PURE__ */ no(
|
|
4565
|
+
function R(e, t) {
|
|
4566
|
+
return /* @__PURE__ */ no(qs, e, t);
|
|
4567
4567
|
}
|
|
4568
|
-
var
|
|
4568
|
+
var Js = /*@__PURE__*/ S("ZodObject", (e, t) => {
|
|
4569
4569
|
fs(), si.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Mo(e, t, n, r), Ot(e, "shape", (e) => e._zod.def.shape, !1);
|
|
4570
4570
|
}, {
|
|
4571
4571
|
keyof() {
|
|
4572
|
-
return
|
|
4572
|
+
return H(Object.keys(this._zod.def.shape));
|
|
4573
4573
|
},
|
|
4574
4574
|
catchall(e) {
|
|
4575
4575
|
return this.clone({
|
|
@@ -4580,19 +4580,19 @@ var Xs = /*@__PURE__*/ S("ZodObject", (e, t) => {
|
|
|
4580
4580
|
passthrough() {
|
|
4581
4581
|
return this.clone({
|
|
4582
4582
|
...this._zod.def,
|
|
4583
|
-
catchall:
|
|
4583
|
+
catchall: L()
|
|
4584
4584
|
});
|
|
4585
4585
|
},
|
|
4586
4586
|
loose() {
|
|
4587
4587
|
return this.clone({
|
|
4588
4588
|
...this._zod.def,
|
|
4589
|
-
catchall:
|
|
4589
|
+
catchall: L()
|
|
4590
4590
|
});
|
|
4591
4591
|
},
|
|
4592
4592
|
strict() {
|
|
4593
4593
|
return this.clone({
|
|
4594
4594
|
...this._zod.def,
|
|
4595
|
-
catchall:
|
|
4595
|
+
catchall: Ks()
|
|
4596
4596
|
});
|
|
4597
4597
|
},
|
|
4598
4598
|
strip() {
|
|
@@ -4617,43 +4617,43 @@ var Xs = /*@__PURE__*/ S("ZodObject", (e, t) => {
|
|
|
4617
4617
|
return at(this, e);
|
|
4618
4618
|
},
|
|
4619
4619
|
partial(...e) {
|
|
4620
|
-
return lt(
|
|
4620
|
+
return lt(ac, this, e[0]);
|
|
4621
4621
|
},
|
|
4622
4622
|
exactPartial(...e) {
|
|
4623
|
-
return lt(
|
|
4623
|
+
return lt(sc, this, e[0], "exactPartial");
|
|
4624
4624
|
},
|
|
4625
4625
|
required(...e) {
|
|
4626
|
-
return ut(
|
|
4626
|
+
return ut(hc, this, e[0]);
|
|
4627
4627
|
}
|
|
4628
4628
|
});
|
|
4629
|
-
function
|
|
4630
|
-
return new
|
|
4629
|
+
function z(e, t) {
|
|
4630
|
+
return new Js({
|
|
4631
4631
|
type: "object",
|
|
4632
4632
|
shape: e ?? {},
|
|
4633
4633
|
...v(t)
|
|
4634
4634
|
});
|
|
4635
4635
|
}
|
|
4636
|
-
var
|
|
4636
|
+
var Ys = /*@__PURE__*/ S("ZodUnion", (e, t) => {
|
|
4637
4637
|
li.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => No(e, t, n, r), e.options = t.options;
|
|
4638
4638
|
});
|
|
4639
|
-
function
|
|
4640
|
-
return new
|
|
4639
|
+
function B(e, t) {
|
|
4640
|
+
return new Ys({
|
|
4641
4641
|
type: "union",
|
|
4642
4642
|
options: e,
|
|
4643
4643
|
...v(t)
|
|
4644
4644
|
});
|
|
4645
4645
|
}
|
|
4646
|
-
var
|
|
4646
|
+
var Xs = /*@__PURE__*/ S("ZodIntersection", (e, t) => {
|
|
4647
4647
|
ui.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Po(e, t, n, r);
|
|
4648
4648
|
});
|
|
4649
|
-
function
|
|
4650
|
-
return new
|
|
4649
|
+
function Zs(e, t) {
|
|
4650
|
+
return new Xs({
|
|
4651
4651
|
type: "intersection",
|
|
4652
4652
|
left: e,
|
|
4653
4653
|
right: t
|
|
4654
4654
|
});
|
|
4655
4655
|
}
|
|
4656
|
-
var
|
|
4656
|
+
var Qs = /*@__PURE__*/ S("ZodTuple", (e, t) => {
|
|
4657
4657
|
fs(), pi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Fo(e, t, n, r);
|
|
4658
4658
|
}, {
|
|
4659
4659
|
rest(e) {
|
|
@@ -4667,46 +4667,46 @@ var ec = /*@__PURE__*/ S("ZodTuple", (e, t) => {
|
|
|
4667
4667
|
if (e.checks?.length) throw Error(".partial() cannot be used on tuple schemas containing refinements");
|
|
4668
4668
|
return this.clone({
|
|
4669
4669
|
...e,
|
|
4670
|
-
items: e.items.map((e) => new
|
|
4670
|
+
items: e.items.map((e) => new ac({
|
|
4671
4671
|
type: "optional",
|
|
4672
4672
|
innerType: e
|
|
4673
4673
|
}))
|
|
4674
4674
|
});
|
|
4675
4675
|
}
|
|
4676
4676
|
});
|
|
4677
|
-
function
|
|
4677
|
+
function $s(e, t, n) {
|
|
4678
4678
|
let r = t instanceof E;
|
|
4679
|
-
return new
|
|
4679
|
+
return new Qs({
|
|
4680
4680
|
type: "tuple",
|
|
4681
4681
|
items: e,
|
|
4682
4682
|
rest: r ? t : null,
|
|
4683
4683
|
...v(r ? n : t)
|
|
4684
4684
|
});
|
|
4685
4685
|
}
|
|
4686
|
-
var
|
|
4686
|
+
var ec = /*@__PURE__*/ S("ZodRecord", (e, t) => {
|
|
4687
4687
|
fs(), _i.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => zo(e, t, n, r), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
4688
4688
|
});
|
|
4689
|
-
function
|
|
4690
|
-
return !t || !t._zod ? new
|
|
4689
|
+
function V(e, t, n) {
|
|
4690
|
+
return !t || !t._zod ? new ec({
|
|
4691
4691
|
type: "record",
|
|
4692
|
-
keyType:
|
|
4692
|
+
keyType: N(),
|
|
4693
4693
|
valueType: e,
|
|
4694
4694
|
...v(t)
|
|
4695
|
-
}) : new
|
|
4695
|
+
}) : new ec({
|
|
4696
4696
|
type: "record",
|
|
4697
4697
|
keyType: e,
|
|
4698
4698
|
valueType: t,
|
|
4699
4699
|
...v(n)
|
|
4700
4700
|
});
|
|
4701
4701
|
}
|
|
4702
|
-
var
|
|
4702
|
+
var tc = /*@__PURE__*/ S("ZodEnum", (e, t) => {
|
|
4703
4703
|
vi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Eo(e, t, n, r), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
4704
4704
|
let n = new Set(Object.keys(t.entries));
|
|
4705
4705
|
e.extract = (e, r) => {
|
|
4706
4706
|
let i = {};
|
|
4707
4707
|
for (let r of e) if (n.has(r)) i[r] = t.entries[r];
|
|
4708
4708
|
else throw Error(`Key ${r} not found in enum`);
|
|
4709
|
-
return new
|
|
4709
|
+
return new tc({
|
|
4710
4710
|
...t,
|
|
4711
4711
|
checks: [],
|
|
4712
4712
|
...v(r),
|
|
@@ -4716,7 +4716,7 @@ var rc = /*@__PURE__*/ S("ZodEnum", (e, t) => {
|
|
|
4716
4716
|
let i = { ...t.entries };
|
|
4717
4717
|
for (let t of e) if (n.has(t)) delete i[t];
|
|
4718
4718
|
else throw Error(`Key ${t} not found in enum`);
|
|
4719
|
-
return new
|
|
4719
|
+
return new tc({
|
|
4720
4720
|
...t,
|
|
4721
4721
|
checks: [],
|
|
4722
4722
|
...v(r),
|
|
@@ -4724,27 +4724,27 @@ var rc = /*@__PURE__*/ S("ZodEnum", (e, t) => {
|
|
|
4724
4724
|
});
|
|
4725
4725
|
};
|
|
4726
4726
|
});
|
|
4727
|
-
function
|
|
4728
|
-
return new
|
|
4727
|
+
function H(e, t) {
|
|
4728
|
+
return new tc({
|
|
4729
4729
|
type: "enum",
|
|
4730
4730
|
entries: Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e,
|
|
4731
4731
|
...v(t)
|
|
4732
4732
|
});
|
|
4733
4733
|
}
|
|
4734
|
-
var
|
|
4734
|
+
var nc = /*@__PURE__*/ S("ZodLiteral", (e, t) => {
|
|
4735
4735
|
yi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Do(e, t, n, r), e.values = new Set(t.values), Object.defineProperty(e, "value", { get() {
|
|
4736
4736
|
if (t.values.length > 1) throw Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4737
4737
|
return t.values[0];
|
|
4738
4738
|
} });
|
|
4739
4739
|
});
|
|
4740
|
-
function
|
|
4741
|
-
return new
|
|
4740
|
+
function U(e, t) {
|
|
4741
|
+
return new nc({
|
|
4742
4742
|
type: "literal",
|
|
4743
4743
|
values: Array.isArray(e) ? e : [e],
|
|
4744
4744
|
...v(t)
|
|
4745
4745
|
});
|
|
4746
4746
|
}
|
|
4747
|
-
var
|
|
4747
|
+
var rc = /*@__PURE__*/ S("ZodTransform", (e, t) => {
|
|
4748
4748
|
fs(), bi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => ko(e, t, n, r), e._zod.parse = (n, r) => {
|
|
4749
4749
|
if (r.direction === "backward") throw new It(e.constructor.name);
|
|
4750
4750
|
n.addIssue = (r) => {
|
|
@@ -4758,44 +4758,44 @@ var ac = /*@__PURE__*/ S("ZodTransform", (e, t) => {
|
|
|
4758
4758
|
return i instanceof Promise ? i.then((e) => (n.value = e, n)) : (n.value = i, n);
|
|
4759
4759
|
};
|
|
4760
4760
|
});
|
|
4761
|
-
function
|
|
4762
|
-
return new
|
|
4761
|
+
function ic(e) {
|
|
4762
|
+
return new rc({
|
|
4763
4763
|
type: "transform",
|
|
4764
4764
|
transform: e
|
|
4765
4765
|
});
|
|
4766
4766
|
}
|
|
4767
|
-
var
|
|
4767
|
+
var ac = /*@__PURE__*/ S("ZodOptional", (e, t) => {
|
|
4768
4768
|
Si.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Yo(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
4769
4769
|
});
|
|
4770
|
-
function
|
|
4771
|
-
return new
|
|
4770
|
+
function oc(e) {
|
|
4771
|
+
return new ac({
|
|
4772
4772
|
type: "optional",
|
|
4773
4773
|
innerType: e
|
|
4774
4774
|
});
|
|
4775
4775
|
}
|
|
4776
|
-
var
|
|
4776
|
+
var sc = /*@__PURE__*/ S("ZodExactOptional", (e, t) => {
|
|
4777
4777
|
Ci.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Yo(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
4778
4778
|
});
|
|
4779
|
-
function
|
|
4780
|
-
return new
|
|
4779
|
+
function cc(e) {
|
|
4780
|
+
return new sc({
|
|
4781
4781
|
type: "optional",
|
|
4782
4782
|
innerType: e
|
|
4783
4783
|
});
|
|
4784
4784
|
}
|
|
4785
|
-
var
|
|
4785
|
+
var lc = /*@__PURE__*/ S("ZodNullable", (e, t) => {
|
|
4786
4786
|
wi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Bo(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
4787
4787
|
});
|
|
4788
|
-
function
|
|
4789
|
-
return new
|
|
4788
|
+
function uc(e) {
|
|
4789
|
+
return new lc({
|
|
4790
4790
|
type: "nullable",
|
|
4791
4791
|
innerType: e
|
|
4792
4792
|
});
|
|
4793
4793
|
}
|
|
4794
|
-
var
|
|
4794
|
+
var dc = /*@__PURE__*/ S("ZodDefault", (e, t) => {
|
|
4795
4795
|
Ti.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Wo(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
4796
4796
|
});
|
|
4797
|
-
function
|
|
4798
|
-
return new
|
|
4797
|
+
function fc(e, t) {
|
|
4798
|
+
return new dc({
|
|
4799
4799
|
type: "default",
|
|
4800
4800
|
innerType: e,
|
|
4801
4801
|
get defaultValue() {
|
|
@@ -4803,11 +4803,11 @@ function mc(e, t) {
|
|
|
4803
4803
|
}
|
|
4804
4804
|
});
|
|
4805
4805
|
}
|
|
4806
|
-
var
|
|
4806
|
+
var pc = /*@__PURE__*/ S("ZodPrefault", (e, t) => {
|
|
4807
4807
|
Di.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Go(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
4808
4808
|
});
|
|
4809
|
-
function
|
|
4810
|
-
return new
|
|
4809
|
+
function mc(e, t) {
|
|
4810
|
+
return new pc({
|
|
4811
4811
|
type: "prefault",
|
|
4812
4812
|
innerType: e,
|
|
4813
4813
|
get defaultValue() {
|
|
@@ -4815,170 +4815,170 @@ function gc(e, t) {
|
|
|
4815
4815
|
}
|
|
4816
4816
|
});
|
|
4817
4817
|
}
|
|
4818
|
-
var
|
|
4818
|
+
var hc = /*@__PURE__*/ S("ZodNonOptional", (e, t) => {
|
|
4819
4819
|
Oi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Vo(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
4820
4820
|
});
|
|
4821
|
-
function
|
|
4822
|
-
return new
|
|
4821
|
+
function gc(e, t) {
|
|
4822
|
+
return new hc({
|
|
4823
4823
|
type: "nonoptional",
|
|
4824
4824
|
innerType: e,
|
|
4825
4825
|
...v(t)
|
|
4826
4826
|
});
|
|
4827
4827
|
}
|
|
4828
|
-
var
|
|
4828
|
+
var _c = /*@__PURE__*/ S("ZodCatch", (e, t) => {
|
|
4829
4829
|
ji.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ko(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
4830
4830
|
});
|
|
4831
|
-
function
|
|
4832
|
-
return new
|
|
4831
|
+
function vc(e, t) {
|
|
4832
|
+
return new _c({
|
|
4833
4833
|
type: "catch",
|
|
4834
4834
|
innerType: e,
|
|
4835
4835
|
catchValue: typeof t == "function" ? t : At(t)
|
|
4836
4836
|
});
|
|
4837
4837
|
}
|
|
4838
|
-
var
|
|
4838
|
+
var yc = /*@__PURE__*/ S("ZodPipe", (e, t) => {
|
|
4839
4839
|
Mi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => qo(e, t, n, r), e.in = t.in, e.out = t.out;
|
|
4840
4840
|
});
|
|
4841
|
-
function
|
|
4842
|
-
return new
|
|
4841
|
+
function bc(e, t) {
|
|
4842
|
+
return new yc({
|
|
4843
4843
|
type: "pipe",
|
|
4844
4844
|
in: e,
|
|
4845
4845
|
out: t
|
|
4846
4846
|
});
|
|
4847
4847
|
}
|
|
4848
|
-
var
|
|
4848
|
+
var xc = /*@__PURE__*/ S("ZodReadonly", (e, t) => {
|
|
4849
4849
|
Pi.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Jo(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
|
|
4850
4850
|
});
|
|
4851
|
-
function
|
|
4852
|
-
return new
|
|
4851
|
+
function Sc(e) {
|
|
4852
|
+
return new xc({
|
|
4853
4853
|
type: "readonly",
|
|
4854
4854
|
innerType: e
|
|
4855
4855
|
});
|
|
4856
4856
|
}
|
|
4857
|
-
var
|
|
4857
|
+
var Cc = /*@__PURE__*/ S("ZodLazy", (e, t) => {
|
|
4858
4858
|
Ii.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Xo(e, t, n, r), e.unwrap = () => e._zod.def.getter();
|
|
4859
4859
|
});
|
|
4860
|
-
function
|
|
4861
|
-
return new
|
|
4860
|
+
function wc(e) {
|
|
4861
|
+
return new Cc({
|
|
4862
4862
|
type: "lazy",
|
|
4863
4863
|
getter: e
|
|
4864
4864
|
});
|
|
4865
4865
|
}
|
|
4866
|
-
var
|
|
4866
|
+
var Tc = /*@__PURE__*/ S("ZodCustom", (e, t) => {
|
|
4867
4867
|
Li.init(e, t), M.init(e, t), e._zod.processJSONSchema = (t, n, r) => Oo(e, t, n, r);
|
|
4868
4868
|
});
|
|
4869
|
-
function
|
|
4870
|
-
return /* @__PURE__ */ ro(
|
|
4869
|
+
function Ec(e, t = {}) {
|
|
4870
|
+
return /* @__PURE__ */ ro(Tc, e, t);
|
|
4871
4871
|
}
|
|
4872
|
-
function
|
|
4872
|
+
function Dc(e, t) {
|
|
4873
4873
|
return /* @__PURE__ */ io(e, t);
|
|
4874
4874
|
}
|
|
4875
|
-
function
|
|
4876
|
-
let t =
|
|
4877
|
-
|
|
4878
|
-
P(),
|
|
4875
|
+
function Oc(e) {
|
|
4876
|
+
let t = wc(() => B([
|
|
4877
|
+
N(e),
|
|
4879
4878
|
F(),
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4879
|
+
I(),
|
|
4880
|
+
Us(),
|
|
4881
|
+
R(t),
|
|
4882
|
+
V(N(), t)
|
|
4883
4883
|
]));
|
|
4884
4884
|
return t;
|
|
4885
4885
|
}
|
|
4886
4886
|
//#endregion
|
|
4887
4887
|
//#region src/flow/common/changeSchema.ts
|
|
4888
|
-
var
|
|
4889
|
-
description:
|
|
4890
|
-
jsonSchema:
|
|
4891
|
-
nullable:
|
|
4892
|
-
handle:
|
|
4893
|
-
}),
|
|
4894
|
-
collapsed:
|
|
4895
|
-
group:
|
|
4896
|
-
}),
|
|
4897
|
-
kind:
|
|
4898
|
-
nodeId:
|
|
4899
|
-
output:
|
|
4900
|
-
}),
|
|
4901
|
-
kind:
|
|
4902
|
-
input:
|
|
4903
|
-
}),
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
kind:
|
|
4908
|
-
bindingId:
|
|
4888
|
+
var W = N(), G = Oc(), kc = R(W), Ac = z({
|
|
4889
|
+
description: W.optional(),
|
|
4890
|
+
jsonSchema: G,
|
|
4891
|
+
nullable: I(),
|
|
4892
|
+
handle: W
|
|
4893
|
+
}), K = Ac.extend({ value: G.optional() }), jc = z({
|
|
4894
|
+
collapsed: I().optional(),
|
|
4895
|
+
group: W
|
|
4896
|
+
}), Mc = z({
|
|
4897
|
+
kind: U("node"),
|
|
4898
|
+
nodeId: W,
|
|
4899
|
+
output: W
|
|
4900
|
+
}), Nc = z({
|
|
4901
|
+
kind: U("flow"),
|
|
4902
|
+
input: W
|
|
4903
|
+
}), Pc = B([
|
|
4904
|
+
Mc,
|
|
4905
|
+
Nc,
|
|
4906
|
+
z({
|
|
4907
|
+
kind: U("binding"),
|
|
4908
|
+
bindingId: W
|
|
4909
4909
|
})
|
|
4910
|
-
]),
|
|
4911
|
-
kind:
|
|
4912
|
-
value:
|
|
4913
|
-
}),
|
|
4914
|
-
kind:
|
|
4915
|
-
sources:
|
|
4916
|
-
})]),
|
|
4917
|
-
inputs:
|
|
4918
|
-
outputs:
|
|
4919
|
-
},
|
|
4920
|
-
kind:
|
|
4921
|
-
action:
|
|
4922
|
-
connectionId:
|
|
4923
|
-
connections:
|
|
4924
|
-
connectionId:
|
|
4925
|
-
alias:
|
|
4910
|
+
]), Fc = B([z({
|
|
4911
|
+
kind: U("value"),
|
|
4912
|
+
value: G
|
|
4913
|
+
}), z({
|
|
4914
|
+
kind: U("sources"),
|
|
4915
|
+
sources: R(Pc)
|
|
4916
|
+
})]), Ic = V(W, Fc), Lc = {
|
|
4917
|
+
inputs: R(B([K, jc])),
|
|
4918
|
+
outputs: R(B([Ac, jc]))
|
|
4919
|
+
}, Rc = z({
|
|
4920
|
+
kind: U("connector"),
|
|
4921
|
+
action: W,
|
|
4922
|
+
connectionId: W.optional(),
|
|
4923
|
+
connections: R(z({
|
|
4924
|
+
connectionId: W,
|
|
4925
|
+
alias: W.optional()
|
|
4926
4926
|
}))
|
|
4927
|
-
}),
|
|
4928
|
-
...
|
|
4929
|
-
name:
|
|
4930
|
-
moduleId:
|
|
4931
|
-
capabilities:
|
|
4932
|
-
}),
|
|
4933
|
-
kind:
|
|
4934
|
-
value:
|
|
4935
|
-
}),
|
|
4936
|
-
kind:
|
|
4937
|
-
input:
|
|
4938
|
-
})]),
|
|
4939
|
-
...
|
|
4940
|
-
name:
|
|
4941
|
-
executor:
|
|
4942
|
-
|
|
4943
|
-
kind:
|
|
4944
|
-
action:
|
|
4945
|
-
connectionId:
|
|
4927
|
+
}), zc = z({
|
|
4928
|
+
...Lc,
|
|
4929
|
+
name: W,
|
|
4930
|
+
moduleId: W,
|
|
4931
|
+
capabilities: R(Rc).optional()
|
|
4932
|
+
}), Bc = B([z({
|
|
4933
|
+
kind: U("value"),
|
|
4934
|
+
value: G
|
|
4935
|
+
}), z({
|
|
4936
|
+
kind: U("input"),
|
|
4937
|
+
input: W
|
|
4938
|
+
})]), Vc = B([Bc, z({ kind: U("model") })]), Hc = z({
|
|
4939
|
+
...Lc,
|
|
4940
|
+
name: W,
|
|
4941
|
+
executor: B([
|
|
4942
|
+
z({
|
|
4943
|
+
kind: U("connector"),
|
|
4944
|
+
action: W,
|
|
4945
|
+
connectionId: W.optional()
|
|
4946
4946
|
}),
|
|
4947
|
-
|
|
4948
|
-
kind:
|
|
4949
|
-
mode:
|
|
4947
|
+
z({
|
|
4948
|
+
kind: U("llm"),
|
|
4949
|
+
mode: H(["chat", "json"])
|
|
4950
4950
|
}),
|
|
4951
|
-
|
|
4952
|
-
kind:
|
|
4953
|
-
code:
|
|
4954
|
-
model:
|
|
4955
|
-
prompt:
|
|
4956
|
-
system:
|
|
4957
|
-
maxRounds:
|
|
4958
|
-
tools:
|
|
4959
|
-
id:
|
|
4960
|
-
name:
|
|
4961
|
-
description:
|
|
4962
|
-
action:
|
|
4963
|
-
connectionId:
|
|
4964
|
-
approval:
|
|
4965
|
-
inputs:
|
|
4951
|
+
z({
|
|
4952
|
+
kind: U("agent"),
|
|
4953
|
+
code: I().optional(),
|
|
4954
|
+
model: W,
|
|
4955
|
+
prompt: Bc,
|
|
4956
|
+
system: W,
|
|
4957
|
+
maxRounds: F(),
|
|
4958
|
+
tools: R(z({
|
|
4959
|
+
id: W,
|
|
4960
|
+
name: W,
|
|
4961
|
+
description: W,
|
|
4962
|
+
action: W,
|
|
4963
|
+
connectionId: W.optional(),
|
|
4964
|
+
approval: I(),
|
|
4965
|
+
inputs: R(K.extend({ source: Vc }))
|
|
4966
4966
|
})),
|
|
4967
|
-
notification:
|
|
4968
|
-
taskId:
|
|
4969
|
-
messageHandle:
|
|
4970
|
-
inputs:
|
|
4967
|
+
notification: z({
|
|
4968
|
+
taskId: W,
|
|
4969
|
+
messageHandle: W,
|
|
4970
|
+
inputs: V(W, Bc)
|
|
4971
4971
|
}).optional()
|
|
4972
4972
|
})
|
|
4973
4973
|
])
|
|
4974
|
-
}),
|
|
4975
|
-
input:
|
|
4976
|
-
cases:
|
|
4977
|
-
output:
|
|
4978
|
-
relation:
|
|
4979
|
-
expressions:
|
|
4980
|
-
input:
|
|
4981
|
-
operator:
|
|
4974
|
+
}), Uc = {
|
|
4975
|
+
input: K,
|
|
4976
|
+
cases: R(z({
|
|
4977
|
+
output: W,
|
|
4978
|
+
relation: H(["all", "any"]),
|
|
4979
|
+
expressions: R(z({
|
|
4980
|
+
input: W,
|
|
4981
|
+
operator: H([
|
|
4982
4982
|
"!=",
|
|
4983
4983
|
"<",
|
|
4984
4984
|
"<=",
|
|
@@ -5000,63 +5000,63 @@ var H = hs(), U = Ac(), jc = I(H), Mc = L({
|
|
|
5000
5000
|
"notHasValue",
|
|
5001
5001
|
"startsWith"
|
|
5002
5002
|
]),
|
|
5003
|
-
value:
|
|
5003
|
+
value: G.optional()
|
|
5004
5004
|
}))
|
|
5005
5005
|
})),
|
|
5006
|
-
defaultOutput:
|
|
5007
|
-
},
|
|
5008
|
-
actions:
|
|
5009
|
-
prompt:
|
|
5010
|
-
notification:
|
|
5011
|
-
inputs:
|
|
5012
|
-
messageHandle:
|
|
5013
|
-
taskId:
|
|
5006
|
+
defaultOutput: W.optional()
|
|
5007
|
+
}, Wc = {
|
|
5008
|
+
actions: B([$s([U("continue")]), $s([U("approve"), U("reject")])]),
|
|
5009
|
+
prompt: W,
|
|
5010
|
+
notification: z({
|
|
5011
|
+
inputs: Ic,
|
|
5012
|
+
messageHandle: W,
|
|
5013
|
+
taskId: W
|
|
5014
5014
|
}).optional()
|
|
5015
|
-
},
|
|
5016
|
-
inputsDef:
|
|
5017
|
-
options:
|
|
5018
|
-
allowedMethods:
|
|
5019
|
-
allowedOrigins:
|
|
5020
|
-
noResponseBody:
|
|
5021
|
-
responseData:
|
|
5022
|
-
responseHeaders:
|
|
5023
|
-
responseStatusCode:
|
|
5015
|
+
}, Gc = {
|
|
5016
|
+
inputsDef: R(K),
|
|
5017
|
+
options: z({
|
|
5018
|
+
allowedMethods: kc.optional(),
|
|
5019
|
+
allowedOrigins: kc.optional(),
|
|
5020
|
+
noResponseBody: I().optional(),
|
|
5021
|
+
responseData: W.optional(),
|
|
5022
|
+
responseHeaders: V(W, W).optional(),
|
|
5023
|
+
responseStatusCode: F().optional()
|
|
5024
5024
|
}).optional()
|
|
5025
|
-
},
|
|
5026
|
-
type:
|
|
5027
|
-
expression:
|
|
5028
|
-
timezone:
|
|
5029
|
-
}),
|
|
5030
|
-
type:
|
|
5031
|
-
unit:
|
|
5025
|
+
}, Kc = R(B([z({
|
|
5026
|
+
type: U("cron"),
|
|
5027
|
+
expression: W,
|
|
5028
|
+
timezone: W
|
|
5029
|
+
}), z({
|
|
5030
|
+
type: U("every"),
|
|
5031
|
+
unit: H([
|
|
5032
5032
|
"day",
|
|
5033
5033
|
"hour",
|
|
5034
5034
|
"minute",
|
|
5035
5035
|
"month",
|
|
5036
5036
|
"week"
|
|
5037
5037
|
]),
|
|
5038
|
-
value:
|
|
5039
|
-
})])),
|
|
5040
|
-
configSchema:
|
|
5041
|
-
definitionVersion:
|
|
5042
|
-
description:
|
|
5043
|
-
displayName:
|
|
5044
|
-
key:
|
|
5045
|
-
name:
|
|
5046
|
-
payloadSchema:
|
|
5047
|
-
provider:
|
|
5048
|
-
},
|
|
5049
|
-
body:
|
|
5050
|
-
allowArray:
|
|
5051
|
-
allowEmpty:
|
|
5052
|
-
formats:
|
|
5038
|
+
value: F()
|
|
5039
|
+
})])), qc = {
|
|
5040
|
+
configSchema: G,
|
|
5041
|
+
definitionVersion: F(),
|
|
5042
|
+
description: W,
|
|
5043
|
+
displayName: W,
|
|
5044
|
+
key: W,
|
|
5045
|
+
name: W,
|
|
5046
|
+
payloadSchema: G,
|
|
5047
|
+
provider: W
|
|
5048
|
+
}, Jc = z({
|
|
5049
|
+
body: z({
|
|
5050
|
+
allowArray: I(),
|
|
5051
|
+
allowEmpty: I(),
|
|
5052
|
+
formats: R(H([
|
|
5053
5053
|
"form",
|
|
5054
5054
|
"json",
|
|
5055
5055
|
"multipart",
|
|
5056
5056
|
"text"
|
|
5057
5057
|
]))
|
|
5058
5058
|
}),
|
|
5059
|
-
methods:
|
|
5059
|
+
methods: R(H([
|
|
5060
5060
|
"DELETE",
|
|
5061
5061
|
"GET",
|
|
5062
5062
|
"HEAD",
|
|
@@ -5064,302 +5064,363 @@ var H = hs(), U = Ac(), jc = I(H), Mc = L({
|
|
|
5064
5064
|
"POST",
|
|
5065
5065
|
"PUT"
|
|
5066
5066
|
])),
|
|
5067
|
-
successStatus:
|
|
5068
|
-
}),
|
|
5069
|
-
name:
|
|
5070
|
-
description:
|
|
5071
|
-
icon:
|
|
5072
|
-
},
|
|
5073
|
-
inputs:
|
|
5074
|
-
name:
|
|
5075
|
-
description:
|
|
5076
|
-
icon:
|
|
5077
|
-
timeoutMs:
|
|
5078
|
-
},
|
|
5079
|
-
|
|
5080
|
-
...
|
|
5081
|
-
kind:
|
|
5082
|
-
...
|
|
5067
|
+
successStatus: F()
|
|
5068
|
+
}), Yc = {
|
|
5069
|
+
name: W,
|
|
5070
|
+
description: W.optional(),
|
|
5071
|
+
icon: W.optional()
|
|
5072
|
+
}, Xc = {
|
|
5073
|
+
inputs: Ic,
|
|
5074
|
+
name: W.optional(),
|
|
5075
|
+
description: W.optional(),
|
|
5076
|
+
icon: W.optional(),
|
|
5077
|
+
timeoutMs: F().optional()
|
|
5078
|
+
}, Zc = B([
|
|
5079
|
+
z({
|
|
5080
|
+
...Xc,
|
|
5081
|
+
kind: U("condition"),
|
|
5082
|
+
...Uc
|
|
5083
5083
|
}),
|
|
5084
|
-
|
|
5085
|
-
...
|
|
5086
|
-
inputs:
|
|
5087
|
-
kind:
|
|
5088
|
-
values:
|
|
5084
|
+
z({
|
|
5085
|
+
...Xc,
|
|
5086
|
+
inputs: L().transform(() => ({})).default({}),
|
|
5087
|
+
kind: U("value"),
|
|
5088
|
+
values: R(K)
|
|
5089
5089
|
}),
|
|
5090
|
-
|
|
5091
|
-
...
|
|
5092
|
-
kind:
|
|
5093
|
-
subflowId:
|
|
5090
|
+
z({
|
|
5091
|
+
...Xc,
|
|
5092
|
+
kind: U("subflow"),
|
|
5093
|
+
subflowId: W
|
|
5094
5094
|
}),
|
|
5095
|
-
|
|
5096
|
-
...
|
|
5097
|
-
kind:
|
|
5098
|
-
task:
|
|
5099
|
-
additionalInputs:
|
|
5095
|
+
z({
|
|
5096
|
+
...Xc,
|
|
5097
|
+
kind: U("task"),
|
|
5098
|
+
task: zc,
|
|
5099
|
+
additionalInputs: R(K).optional()
|
|
5100
5100
|
}),
|
|
5101
|
-
|
|
5102
|
-
...
|
|
5103
|
-
kind:
|
|
5104
|
-
taskId:
|
|
5105
|
-
additionalInputs:
|
|
5101
|
+
z({
|
|
5102
|
+
...Xc,
|
|
5103
|
+
kind: U("task"),
|
|
5104
|
+
taskId: W,
|
|
5105
|
+
additionalInputs: R(K).optional()
|
|
5106
5106
|
}),
|
|
5107
|
-
|
|
5108
|
-
...
|
|
5109
|
-
kind:
|
|
5110
|
-
input:
|
|
5111
|
-
...
|
|
5107
|
+
z({
|
|
5108
|
+
...Xc,
|
|
5109
|
+
kind: U("wait"),
|
|
5110
|
+
input: K,
|
|
5111
|
+
...Wc
|
|
5112
5112
|
}).omit({ timeoutMs: !0 }),
|
|
5113
|
-
|
|
5114
|
-
...
|
|
5115
|
-
kind:
|
|
5113
|
+
z({
|
|
5114
|
+
...Yc,
|
|
5115
|
+
kind: U("manual")
|
|
5116
5116
|
}),
|
|
5117
|
-
|
|
5118
|
-
...
|
|
5119
|
-
kind:
|
|
5120
|
-
...
|
|
5117
|
+
z({
|
|
5118
|
+
...Yc,
|
|
5119
|
+
kind: U("webhook"),
|
|
5120
|
+
...Gc
|
|
5121
5121
|
}),
|
|
5122
|
-
|
|
5123
|
-
...
|
|
5124
|
-
kind:
|
|
5125
|
-
cronTimes:
|
|
5122
|
+
z({
|
|
5123
|
+
...Yc,
|
|
5124
|
+
kind: U("cron"),
|
|
5125
|
+
cronTimes: Kc
|
|
5126
5126
|
}),
|
|
5127
|
-
|
|
5128
|
-
...
|
|
5129
|
-
kind:
|
|
5130
|
-
bindingId:
|
|
5131
|
-
config:
|
|
5132
|
-
definition:
|
|
5133
|
-
...
|
|
5134
|
-
type:
|
|
5127
|
+
z({
|
|
5128
|
+
...Yc,
|
|
5129
|
+
kind: U("poll"),
|
|
5130
|
+
bindingId: W,
|
|
5131
|
+
config: V(W, G),
|
|
5132
|
+
definition: z({
|
|
5133
|
+
...qc,
|
|
5134
|
+
type: U("poll")
|
|
5135
5135
|
}),
|
|
5136
|
-
pollTimes:
|
|
5136
|
+
pollTimes: Kc
|
|
5137
5137
|
}),
|
|
5138
|
-
|
|
5139
|
-
...
|
|
5140
|
-
kind:
|
|
5141
|
-
bindingId:
|
|
5142
|
-
config:
|
|
5143
|
-
definition:
|
|
5144
|
-
...
|
|
5145
|
-
type:
|
|
5146
|
-
endpoint:
|
|
5138
|
+
z({
|
|
5139
|
+
...Yc,
|
|
5140
|
+
kind: U("integration"),
|
|
5141
|
+
bindingId: W,
|
|
5142
|
+
config: V(W, G),
|
|
5143
|
+
definition: z({
|
|
5144
|
+
...qc,
|
|
5145
|
+
type: U("integration"),
|
|
5146
|
+
endpoint: Jc
|
|
5147
5147
|
})
|
|
5148
5148
|
})
|
|
5149
|
-
]),
|
|
5150
|
-
kind:
|
|
5151
|
-
id:
|
|
5152
|
-
})]),
|
|
5153
|
-
source:
|
|
5154
|
-
target:
|
|
5155
|
-
sourceHandle:
|
|
5156
|
-
}),
|
|
5157
|
-
nodeId:
|
|
5158
|
-
target:
|
|
5159
|
-
},
|
|
5160
|
-
name:
|
|
5161
|
-
inputs:
|
|
5162
|
-
outputs:
|
|
5163
|
-
}),
|
|
5164
|
-
nodes:
|
|
5165
|
-
edges:
|
|
5166
|
-
}),
|
|
5167
|
-
kind:
|
|
5168
|
-
target:
|
|
5169
|
-
}),
|
|
5170
|
-
name:
|
|
5171
|
-
imports:
|
|
5172
|
-
source:
|
|
5173
|
-
}),
|
|
5174
|
-
bindings:
|
|
5175
|
-
graph:
|
|
5176
|
-
subflows:
|
|
5177
|
-
tasks:
|
|
5149
|
+
]), Qc = B([z({ kind: U("flow") }), z({
|
|
5150
|
+
kind: U("subflow"),
|
|
5151
|
+
id: W
|
|
5152
|
+
})]), $c = z({
|
|
5153
|
+
source: W,
|
|
5154
|
+
target: W,
|
|
5155
|
+
sourceHandle: W.optional()
|
|
5156
|
+
}), q = {
|
|
5157
|
+
nodeId: W,
|
|
5158
|
+
target: Qc
|
|
5159
|
+
}, el = z({
|
|
5160
|
+
name: W,
|
|
5161
|
+
inputs: R(K),
|
|
5162
|
+
outputs: R(Ac.extend({ sources: R(B([Mc, Nc])) }))
|
|
5163
|
+
}), tl = z({
|
|
5164
|
+
nodes: V(W, Zc),
|
|
5165
|
+
edges: R($c).default([])
|
|
5166
|
+
}), nl = z({
|
|
5167
|
+
kind: H(["connection", "variable"]),
|
|
5168
|
+
target: W
|
|
5169
|
+
}), rl = z({
|
|
5170
|
+
name: W,
|
|
5171
|
+
imports: kc,
|
|
5172
|
+
source: W
|
|
5173
|
+
}), il = z({
|
|
5174
|
+
bindings: V(W, nl),
|
|
5175
|
+
graph: tl,
|
|
5176
|
+
subflows: V(W, el.extend({ graph: tl })),
|
|
5177
|
+
tasks: V(W, Hc)
|
|
5178
5178
|
});
|
|
5179
|
-
|
|
5180
|
-
modelVersion:
|
|
5181
|
-
document:
|
|
5182
|
-
modules:
|
|
5179
|
+
z({
|
|
5180
|
+
modelVersion: U(1),
|
|
5181
|
+
document: il,
|
|
5182
|
+
modules: V(W, rl)
|
|
5183
5183
|
}).extend({
|
|
5184
|
-
kind:
|
|
5185
|
-
version:
|
|
5184
|
+
kind: U("open-flow-flow-revision"),
|
|
5185
|
+
version: U(1)
|
|
5186
5186
|
});
|
|
5187
|
-
var
|
|
5187
|
+
var al = {
|
|
5188
5188
|
"binding.create": {
|
|
5189
|
-
bindingId:
|
|
5190
|
-
binding:
|
|
5189
|
+
bindingId: W,
|
|
5190
|
+
binding: nl
|
|
5191
5191
|
},
|
|
5192
|
-
"binding.delete": { bindingId:
|
|
5192
|
+
"binding.delete": { bindingId: W },
|
|
5193
5193
|
"binding.target.set": {
|
|
5194
|
-
bindingId:
|
|
5195
|
-
before:
|
|
5196
|
-
value:
|
|
5194
|
+
bindingId: W,
|
|
5195
|
+
before: W,
|
|
5196
|
+
value: W
|
|
5197
5197
|
},
|
|
5198
5198
|
"graph.edge.connect": {
|
|
5199
|
-
target:
|
|
5200
|
-
edge:
|
|
5199
|
+
target: Qc,
|
|
5200
|
+
edge: $c
|
|
5201
5201
|
},
|
|
5202
5202
|
"graph.edge.disconnect": {
|
|
5203
|
-
target:
|
|
5204
|
-
edge:
|
|
5203
|
+
target: Qc,
|
|
5204
|
+
edge: $c
|
|
5205
5205
|
},
|
|
5206
5206
|
"graph.node.create": {
|
|
5207
|
-
...
|
|
5208
|
-
node:
|
|
5209
|
-
},
|
|
5210
|
-
"graph.node.delete":
|
|
5211
|
-
"graph.node.field.set":
|
|
5212
|
-
...
|
|
5213
|
-
kind:
|
|
5214
|
-
field:
|
|
5207
|
+
...q,
|
|
5208
|
+
node: Zc
|
|
5209
|
+
},
|
|
5210
|
+
"graph.node.delete": q,
|
|
5211
|
+
"graph.node.field.set": B([z({
|
|
5212
|
+
...q,
|
|
5213
|
+
kind: U("graph.node.field.set"),
|
|
5214
|
+
field: H([
|
|
5215
5215
|
"description",
|
|
5216
5216
|
"icon",
|
|
5217
5217
|
"name"
|
|
5218
5218
|
]),
|
|
5219
|
-
before:
|
|
5220
|
-
value:
|
|
5221
|
-
}),
|
|
5222
|
-
...
|
|
5223
|
-
kind:
|
|
5224
|
-
field:
|
|
5225
|
-
before:
|
|
5226
|
-
value:
|
|
5219
|
+
before: W.optional(),
|
|
5220
|
+
value: W.optional()
|
|
5221
|
+
}), z({
|
|
5222
|
+
...q,
|
|
5223
|
+
kind: U("graph.node.field.set"),
|
|
5224
|
+
field: U("timeoutMs"),
|
|
5225
|
+
before: F().optional(),
|
|
5226
|
+
value: F().optional()
|
|
5227
5227
|
})]),
|
|
5228
5228
|
"graph.node.input.set": {
|
|
5229
|
-
...
|
|
5230
|
-
handle:
|
|
5231
|
-
before:
|
|
5232
|
-
value:
|
|
5229
|
+
...q,
|
|
5230
|
+
handle: W,
|
|
5231
|
+
before: Fc.optional(),
|
|
5232
|
+
value: Fc.optional()
|
|
5233
5233
|
},
|
|
5234
5234
|
"graph.node.additional-inputs.set": {
|
|
5235
|
-
...
|
|
5236
|
-
before:
|
|
5237
|
-
value:
|
|
5235
|
+
...q,
|
|
5236
|
+
before: R(K).optional(),
|
|
5237
|
+
value: R(K).optional()
|
|
5238
5238
|
},
|
|
5239
5239
|
"graph.node.condition.set": {
|
|
5240
|
-
...
|
|
5241
|
-
before:
|
|
5242
|
-
value:
|
|
5240
|
+
...q,
|
|
5241
|
+
before: z(Uc),
|
|
5242
|
+
value: z(Uc)
|
|
5243
5243
|
},
|
|
5244
5244
|
"graph.node.values.set": {
|
|
5245
|
-
...
|
|
5246
|
-
before:
|
|
5247
|
-
value:
|
|
5245
|
+
...q,
|
|
5246
|
+
before: R(K),
|
|
5247
|
+
value: R(K)
|
|
5248
5248
|
},
|
|
5249
5249
|
"graph.node.wait.set": {
|
|
5250
|
-
...
|
|
5251
|
-
target:
|
|
5252
|
-
before:
|
|
5253
|
-
value:
|
|
5250
|
+
...q,
|
|
5251
|
+
target: z({ kind: U("flow") }),
|
|
5252
|
+
before: z(Wc),
|
|
5253
|
+
value: z(Wc)
|
|
5254
5254
|
},
|
|
5255
5255
|
"graph.node.webhook.set": {
|
|
5256
|
-
...
|
|
5257
|
-
target:
|
|
5258
|
-
before:
|
|
5259
|
-
value:
|
|
5256
|
+
...q,
|
|
5257
|
+
target: z({ kind: U("flow") }),
|
|
5258
|
+
before: z(Gc),
|
|
5259
|
+
value: z(Gc)
|
|
5260
5260
|
},
|
|
5261
5261
|
"graph.node.task.ports.set": {
|
|
5262
|
-
...
|
|
5263
|
-
before:
|
|
5264
|
-
value:
|
|
5262
|
+
...q,
|
|
5263
|
+
before: z(Lc),
|
|
5264
|
+
value: z(Lc)
|
|
5265
5265
|
},
|
|
5266
5266
|
"graph.node.task.name.set": {
|
|
5267
|
-
...
|
|
5268
|
-
before:
|
|
5269
|
-
value:
|
|
5267
|
+
...q,
|
|
5268
|
+
before: W,
|
|
5269
|
+
value: W
|
|
5270
5270
|
},
|
|
5271
5271
|
"graph.node.task.capabilities.set": {
|
|
5272
|
-
...
|
|
5273
|
-
before:
|
|
5274
|
-
value:
|
|
5272
|
+
...q,
|
|
5273
|
+
before: R(Rc).optional(),
|
|
5274
|
+
value: R(Rc).optional()
|
|
5275
5275
|
},
|
|
5276
5276
|
"graph.trigger.config.set": {
|
|
5277
|
-
nodeId:
|
|
5278
|
-
name:
|
|
5279
|
-
before:
|
|
5280
|
-
value:
|
|
5277
|
+
nodeId: W,
|
|
5278
|
+
name: W,
|
|
5279
|
+
before: G.optional(),
|
|
5280
|
+
value: G.optional()
|
|
5281
5281
|
},
|
|
5282
5282
|
"graph.trigger.schedule.set": {
|
|
5283
|
-
nodeId:
|
|
5284
|
-
before:
|
|
5285
|
-
value:
|
|
5283
|
+
nodeId: W,
|
|
5284
|
+
before: Kc,
|
|
5285
|
+
value: Kc
|
|
5286
5286
|
},
|
|
5287
5287
|
"module.create": {
|
|
5288
|
-
moduleId:
|
|
5289
|
-
module:
|
|
5288
|
+
moduleId: W,
|
|
5289
|
+
module: rl
|
|
5290
5290
|
},
|
|
5291
|
-
"module.delete": { moduleId:
|
|
5291
|
+
"module.delete": { moduleId: W },
|
|
5292
5292
|
"module.rename": {
|
|
5293
|
-
moduleId:
|
|
5294
|
-
before:
|
|
5295
|
-
name:
|
|
5293
|
+
moduleId: W,
|
|
5294
|
+
before: W,
|
|
5295
|
+
name: W
|
|
5296
5296
|
},
|
|
5297
5297
|
"module.source.replace": {
|
|
5298
|
-
moduleId:
|
|
5299
|
-
beforeImports:
|
|
5300
|
-
beforeSource:
|
|
5301
|
-
imports:
|
|
5302
|
-
source:
|
|
5298
|
+
moduleId: W,
|
|
5299
|
+
beforeImports: kc,
|
|
5300
|
+
beforeSource: W,
|
|
5301
|
+
imports: kc,
|
|
5302
|
+
source: W
|
|
5303
5303
|
},
|
|
5304
5304
|
"subflow.create": {
|
|
5305
|
-
subflowId:
|
|
5306
|
-
subflow:
|
|
5305
|
+
subflowId: W,
|
|
5306
|
+
subflow: el.extend({ graph: tl })
|
|
5307
5307
|
},
|
|
5308
5308
|
"subflow.definition.set": {
|
|
5309
|
-
subflowId:
|
|
5310
|
-
before:
|
|
5311
|
-
definition:
|
|
5309
|
+
subflowId: W,
|
|
5310
|
+
before: el,
|
|
5311
|
+
definition: el
|
|
5312
5312
|
},
|
|
5313
|
-
"subflow.delete": { subflowId:
|
|
5313
|
+
"subflow.delete": { subflowId: W },
|
|
5314
5314
|
"task.create": {
|
|
5315
|
-
taskId:
|
|
5316
|
-
task:
|
|
5315
|
+
taskId: W,
|
|
5316
|
+
task: Hc
|
|
5317
5317
|
},
|
|
5318
|
-
"task.delete": { taskId:
|
|
5318
|
+
"task.delete": { taskId: W },
|
|
5319
5319
|
"task.connector.connection.set": {
|
|
5320
|
-
taskId:
|
|
5321
|
-
before:
|
|
5322
|
-
value:
|
|
5320
|
+
taskId: W,
|
|
5321
|
+
before: W.optional(),
|
|
5322
|
+
value: W.optional()
|
|
5323
5323
|
},
|
|
5324
5324
|
"task.agent.set": {
|
|
5325
|
-
taskId:
|
|
5326
|
-
before:
|
|
5327
|
-
value:
|
|
5325
|
+
taskId: W,
|
|
5326
|
+
before: Hc,
|
|
5327
|
+
value: Hc
|
|
5328
5328
|
},
|
|
5329
5329
|
"task.llm.mode.set": {
|
|
5330
|
-
taskId:
|
|
5331
|
-
before:
|
|
5332
|
-
value:
|
|
5330
|
+
taskId: W,
|
|
5331
|
+
before: H(["chat", "json"]),
|
|
5332
|
+
value: H(["chat", "json"])
|
|
5333
5333
|
},
|
|
5334
5334
|
"task.name.set": {
|
|
5335
|
-
taskId:
|
|
5336
|
-
before:
|
|
5337
|
-
value:
|
|
5335
|
+
taskId: W,
|
|
5336
|
+
before: W,
|
|
5337
|
+
value: W
|
|
5338
5338
|
}
|
|
5339
5339
|
};
|
|
5340
|
-
|
|
5341
|
-
kind:
|
|
5340
|
+
R(B([...new Map(Object.entries(al).map(([e, t]) => [e, t instanceof M ? t : z({
|
|
5341
|
+
kind: U(e),
|
|
5342
5342
|
...t
|
|
5343
5343
|
})])).values()])).min(1);
|
|
5344
5344
|
//#endregion
|
|
5345
5345
|
//#region src/flow/common/encoding.ts
|
|
5346
|
-
var
|
|
5347
|
-
function
|
|
5346
|
+
var ol = new TextEncoder();
|
|
5347
|
+
function sl(e) {
|
|
5348
5348
|
if (e == null || typeof e == "boolean" || typeof e == "string" || typeof e == "number") return JSON.stringify(e);
|
|
5349
|
-
if (Array.isArray(e)) return `[${e.map(
|
|
5349
|
+
if (Array.isArray(e)) return `[${e.map(sl).join(",")}]`;
|
|
5350
5350
|
let t = e;
|
|
5351
|
-
return `{${Object.keys(t).toSorted().map((e) => `${JSON.stringify(e)}:${
|
|
5351
|
+
return `{${Object.keys(t).toSorted().map((e) => `${JSON.stringify(e)}:${sl(t[e])}`).join(",")}}`;
|
|
5352
5352
|
}
|
|
5353
|
-
function
|
|
5354
|
-
return
|
|
5353
|
+
function cl(e) {
|
|
5354
|
+
return ol.encode(sl(e));
|
|
5355
5355
|
}
|
|
5356
|
-
async function
|
|
5356
|
+
async function ll(e) {
|
|
5357
5357
|
let t = new Uint8Array(e.byteLength);
|
|
5358
5358
|
return t.set(e), `sha256:${[...new Uint8Array(await crypto.subtle.digest("SHA-256", t))].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
|
|
5359
5359
|
}
|
|
5360
|
+
var ul = V(N(), L()), dl = z({
|
|
5361
|
+
jsonSchema: L(),
|
|
5362
|
+
nullable: I(),
|
|
5363
|
+
value: L().optional(),
|
|
5364
|
+
description: N().optional()
|
|
5365
|
+
}).strict(), fl = V(N(), dl), pl = B([z({
|
|
5366
|
+
kind: U("value"),
|
|
5367
|
+
value: L()
|
|
5368
|
+
}).strict(), z({
|
|
5369
|
+
kind: U("sources"),
|
|
5370
|
+
sources: R(z({
|
|
5371
|
+
kind: U("node"),
|
|
5372
|
+
nodeId: N(),
|
|
5373
|
+
output: N()
|
|
5374
|
+
}).strict())
|
|
5375
|
+
}).strict()]), ml = {
|
|
5376
|
+
name: N().optional(),
|
|
5377
|
+
description: N().optional(),
|
|
5378
|
+
icon: N().optional()
|
|
5379
|
+
}, hl = B([
|
|
5380
|
+
z({
|
|
5381
|
+
...ml,
|
|
5382
|
+
kind: U("cron"),
|
|
5383
|
+
cronTimes: R(L())
|
|
5384
|
+
}).strict(),
|
|
5385
|
+
z({
|
|
5386
|
+
...ml,
|
|
5387
|
+
kind: U("manual")
|
|
5388
|
+
}).strict(),
|
|
5389
|
+
z({
|
|
5390
|
+
...ml,
|
|
5391
|
+
kind: U("task"),
|
|
5392
|
+
concurrency: U(1).optional(),
|
|
5393
|
+
inputs: V(N(), pl),
|
|
5394
|
+
task: z({
|
|
5395
|
+
name: N(),
|
|
5396
|
+
moduleId: N(),
|
|
5397
|
+
inputs: fl,
|
|
5398
|
+
outputs: V(N(), dl.omit({ value: !0 }))
|
|
5399
|
+
}).strict()
|
|
5400
|
+
}).strict()
|
|
5401
|
+
]);
|
|
5402
|
+
z({
|
|
5403
|
+
name: N(),
|
|
5404
|
+
graph: z({ nodes: V(N(), hl) }).strict()
|
|
5405
|
+
}).strict(), z({
|
|
5406
|
+
kind: U("open-flow-project-revision"),
|
|
5407
|
+
version: U(1),
|
|
5408
|
+
modelVersion: U(1),
|
|
5409
|
+
modules: V(N(), z({
|
|
5410
|
+
name: N(),
|
|
5411
|
+
source: N(),
|
|
5412
|
+
imports: R(N())
|
|
5413
|
+
}).strict()),
|
|
5414
|
+
document: z({
|
|
5415
|
+
bindings: ul,
|
|
5416
|
+
flows: ul,
|
|
5417
|
+
subflows: ul,
|
|
5418
|
+
tasks: ul
|
|
5419
|
+
}).strict()
|
|
5420
|
+
}).strict();
|
|
5360
5421
|
//#endregion
|
|
5361
5422
|
//#region src/trigger/providers/github/watch-pull-request.ts
|
|
5362
|
-
var
|
|
5423
|
+
var gl = {
|
|
5363
5424
|
configSchema: {
|
|
5364
5425
|
type: "object",
|
|
5365
5426
|
additionalProperties: !1,
|
|
@@ -5433,7 +5494,7 @@ var fl = {
|
|
|
5433
5494
|
required: ["pullRequest", "version"]
|
|
5434
5495
|
}
|
|
5435
5496
|
};
|
|
5436
|
-
function
|
|
5497
|
+
function _l(e) {
|
|
5437
5498
|
return {
|
|
5438
5499
|
owner: e.owner,
|
|
5439
5500
|
repo: e.repo,
|
|
@@ -5441,8 +5502,8 @@ function pl(e) {
|
|
|
5441
5502
|
insecureSsl: !1
|
|
5442
5503
|
};
|
|
5443
5504
|
}
|
|
5444
|
-
var
|
|
5445
|
-
snapshot:
|
|
5505
|
+
var vl = {
|
|
5506
|
+
snapshot: gl,
|
|
5446
5507
|
initialState: {
|
|
5447
5508
|
checkpoint: null,
|
|
5448
5509
|
subscription: {}
|
|
@@ -5450,7 +5511,7 @@ var ml = {
|
|
|
5450
5511
|
async reconcile(e) {
|
|
5451
5512
|
if (e.state == null) throw new i("GitHub listener state is missing.");
|
|
5452
5513
|
if (e.active && e.state.checkpoint == null) {
|
|
5453
|
-
let t = await
|
|
5514
|
+
let t = await yl(e);
|
|
5454
5515
|
await e.state.saveCheckpoint({
|
|
5455
5516
|
version: t.version,
|
|
5456
5517
|
sequence: 0
|
|
@@ -5458,13 +5519,13 @@ var ml = {
|
|
|
5458
5519
|
}
|
|
5459
5520
|
return await Ce.reconcile({
|
|
5460
5521
|
...e,
|
|
5461
|
-
config:
|
|
5522
|
+
config: _l(e.config)
|
|
5462
5523
|
});
|
|
5463
5524
|
},
|
|
5464
5525
|
async receive(e) {
|
|
5465
5526
|
let t = await Ce.receive({
|
|
5466
5527
|
...e,
|
|
5467
|
-
config:
|
|
5528
|
+
config: _l(e.config)
|
|
5468
5529
|
});
|
|
5469
5530
|
return t.outcome == "event" ? !Ie(e.payload) || e.payload.number !== e.config.number ? {
|
|
5470
5531
|
outcome: "ignored",
|
|
@@ -5476,7 +5537,7 @@ var ml = {
|
|
|
5476
5537
|
async read(e) {
|
|
5477
5538
|
let t = e.checkpoint;
|
|
5478
5539
|
if (!Ie(t) || typeof t.version != "string" || !Number.isSafeInteger(t.sequence) || Number(t.sequence) < 0 || Number(t.sequence) >= 2 ** 53 - 1) throw new i("GitHub listener checkpoint is invalid.");
|
|
5479
|
-
let n = await
|
|
5540
|
+
let n = await yl(e);
|
|
5480
5541
|
if (n.version == t.version) return {
|
|
5481
5542
|
checkpoint: t,
|
|
5482
5543
|
dedupeKey: n.version,
|
|
@@ -5496,7 +5557,7 @@ var ml = {
|
|
|
5496
5557
|
}
|
|
5497
5558
|
}
|
|
5498
5559
|
};
|
|
5499
|
-
async function
|
|
5560
|
+
async function yl(e) {
|
|
5500
5561
|
let { owner: t, repo: n, number: o } = e.config;
|
|
5501
5562
|
if (typeof t != "string" || typeof n != "string" || !Number.isSafeInteger(o) || Number(o) < 1) throw new i("GitHub pull request configuration is invalid.");
|
|
5502
5563
|
let s = await e.connector.execute({
|
|
@@ -5524,12 +5585,12 @@ async function hl(e) {
|
|
|
5524
5585
|
};
|
|
5525
5586
|
return {
|
|
5526
5587
|
pullRequest: l,
|
|
5527
|
-
version: await
|
|
5588
|
+
version: await ll(cl(l))
|
|
5528
5589
|
};
|
|
5529
5590
|
}
|
|
5530
5591
|
//#endregion
|
|
5531
5592
|
//#region src/trigger/providers/gitlab/on-project-event.ts
|
|
5532
|
-
var
|
|
5593
|
+
var bl = [
|
|
5533
5594
|
"push",
|
|
5534
5595
|
"tag_push",
|
|
5535
5596
|
"issues",
|
|
@@ -5547,7 +5608,7 @@ var gl = [
|
|
|
5547
5608
|
"emoji",
|
|
5548
5609
|
"resource_access_token",
|
|
5549
5610
|
"resource_deploy_token"
|
|
5550
|
-
],
|
|
5611
|
+
], xl = /* @__PURE__ */ new Map([
|
|
5551
5612
|
["Push Hook", "push"],
|
|
5552
5613
|
["Tag Push Hook", "tag_push"],
|
|
5553
5614
|
["Issue Hook", "issues"],
|
|
@@ -5565,7 +5626,7 @@ var gl = [
|
|
|
5565
5626
|
["Emoji Hook", "emoji"],
|
|
5566
5627
|
["Resource Access Token Hook", "resource_access_token"],
|
|
5567
5628
|
["Resource Deploy Token Hook", "resource_deploy_token"]
|
|
5568
|
-
]),
|
|
5629
|
+
]), Sl = {
|
|
5569
5630
|
initialState: {
|
|
5570
5631
|
checkpoint: null,
|
|
5571
5632
|
subscription: {}
|
|
@@ -5576,7 +5637,7 @@ var gl = [
|
|
|
5576
5637
|
properties: {
|
|
5577
5638
|
events: {
|
|
5578
5639
|
items: {
|
|
5579
|
-
enum:
|
|
5640
|
+
enum: bl,
|
|
5580
5641
|
type: "string"
|
|
5581
5642
|
},
|
|
5582
5643
|
minItems: 1,
|
|
@@ -5649,12 +5710,12 @@ var gl = [
|
|
|
5649
5710
|
outcome: "ignored",
|
|
5650
5711
|
reason: "GitLab event header is missing."
|
|
5651
5712
|
};
|
|
5652
|
-
let n =
|
|
5713
|
+
let n = xl.get(t);
|
|
5653
5714
|
if (n == null) return {
|
|
5654
5715
|
outcome: "ignored",
|
|
5655
5716
|
reason: "GitLab event header is unknown."
|
|
5656
5717
|
};
|
|
5657
|
-
if (!
|
|
5718
|
+
if (!Cl(e.config).events.includes(n)) return {
|
|
5658
5719
|
outcome: "ignored",
|
|
5659
5720
|
reason: "GitLab event is not subscribed."
|
|
5660
5721
|
};
|
|
@@ -5671,36 +5732,36 @@ var gl = [
|
|
|
5671
5732
|
};
|
|
5672
5733
|
},
|
|
5673
5734
|
async reconcile(e) {
|
|
5674
|
-
let t =
|
|
5735
|
+
let t = jl(e.state), n = Cl(e.config), r = Ml(t);
|
|
5675
5736
|
if (!e.active) {
|
|
5676
|
-
let i = r == null ? await
|
|
5677
|
-
for (let t of i ?? []) await
|
|
5678
|
-
return await t.saveSubscription({},
|
|
5737
|
+
let i = r == null ? await El(e, n) : [r];
|
|
5738
|
+
for (let t of i ?? []) await Dl(e, n, t);
|
|
5739
|
+
return await t.saveSubscription({}, Nl(e.now)), { outcome: "ready" };
|
|
5679
5740
|
}
|
|
5680
|
-
let a = await
|
|
5741
|
+
let a = await El(e, n);
|
|
5681
5742
|
if (a == null) throw new i("The GitLab project does not exist or is not visible.");
|
|
5682
5743
|
let o = r ?? a[0];
|
|
5683
5744
|
if (o == null) {
|
|
5684
|
-
let t = await
|
|
5685
|
-
body:
|
|
5686
|
-
endpoint:
|
|
5745
|
+
let t = await Ol(e, "hook create", {
|
|
5746
|
+
body: Tl(e.endpointUrl, e.callbackSecret, n),
|
|
5747
|
+
endpoint: wl(n),
|
|
5687
5748
|
method: "POST"
|
|
5688
5749
|
});
|
|
5689
|
-
|
|
5750
|
+
kl(t, "hook create"), o = Al(t.data);
|
|
5690
5751
|
} else {
|
|
5691
|
-
let r = await
|
|
5692
|
-
body:
|
|
5693
|
-
endpoint: `${
|
|
5752
|
+
let r = await Ol(e, "hook update", {
|
|
5753
|
+
body: Tl(e.endpointUrl, e.callbackSecret, n),
|
|
5754
|
+
endpoint: `${wl(n)}/${o}`,
|
|
5694
5755
|
method: "PUT"
|
|
5695
5756
|
});
|
|
5696
5757
|
if (r.status == 404) return await t.saveSubscription({}, e.now), { outcome: "pending" };
|
|
5697
|
-
|
|
5758
|
+
kl(r, "hook update");
|
|
5698
5759
|
}
|
|
5699
|
-
for (let t of a.filter((e) => e != o)) await
|
|
5700
|
-
return await t.saveSubscription({ hookId: o },
|
|
5760
|
+
for (let t of a.filter((e) => e != o)) await Dl(e, n, t);
|
|
5761
|
+
return await t.saveSubscription({ hookId: o }, Nl(e.now)), { outcome: "ready" };
|
|
5701
5762
|
}
|
|
5702
5763
|
};
|
|
5703
|
-
function
|
|
5764
|
+
function Cl(e) {
|
|
5704
5765
|
return {
|
|
5705
5766
|
events: e.events,
|
|
5706
5767
|
insecureSsl: e.insecureSsl ?? !1,
|
|
@@ -5708,10 +5769,10 @@ function yl(e) {
|
|
|
5708
5769
|
pushBranchFilter: e.pushBranchFilter ?? ""
|
|
5709
5770
|
};
|
|
5710
5771
|
}
|
|
5711
|
-
function
|
|
5772
|
+
function wl(e) {
|
|
5712
5773
|
return `/projects/${encodeURIComponent(e.project)}/hooks`;
|
|
5713
5774
|
}
|
|
5714
|
-
function
|
|
5775
|
+
function Tl(e, t, n) {
|
|
5715
5776
|
return {
|
|
5716
5777
|
branch_filter_strategy: "wildcard",
|
|
5717
5778
|
description: "Managed by Open Flow.",
|
|
@@ -5720,14 +5781,14 @@ function xl(e, t, n) {
|
|
|
5720
5781
|
push_events_branch_filter: n.pushBranchFilter,
|
|
5721
5782
|
url: e,
|
|
5722
5783
|
token: t,
|
|
5723
|
-
...Object.fromEntries(
|
|
5784
|
+
...Object.fromEntries(bl.map((e) => [`${e}_events`, n.events.includes(e)]))
|
|
5724
5785
|
};
|
|
5725
5786
|
}
|
|
5726
|
-
async function
|
|
5787
|
+
async function El(e, t) {
|
|
5727
5788
|
let n = [];
|
|
5728
5789
|
for (let r = 1; r <= 10; r += 1) {
|
|
5729
|
-
let i = await
|
|
5730
|
-
endpoint:
|
|
5790
|
+
let i = await Ol(e, "hook list", {
|
|
5791
|
+
endpoint: wl(t),
|
|
5731
5792
|
method: "GET",
|
|
5732
5793
|
query: {
|
|
5733
5794
|
page: r,
|
|
@@ -5735,59 +5796,59 @@ async function Sl(e, t) {
|
|
|
5735
5796
|
}
|
|
5736
5797
|
});
|
|
5737
5798
|
if (i.status == 404) return null;
|
|
5738
|
-
|
|
5799
|
+
kl(i, "hook list");
|
|
5739
5800
|
let a = Array.isArray(i.data) ? i.data : [];
|
|
5740
5801
|
for (let t of a) {
|
|
5741
|
-
let r =
|
|
5802
|
+
let r = Pl(t);
|
|
5742
5803
|
r?.url === e.endpointUrl && (typeof r.id == "number" || typeof r.id == "string") && n.push(String(r.id));
|
|
5743
5804
|
}
|
|
5744
5805
|
if (a.length < 100) break;
|
|
5745
5806
|
}
|
|
5746
5807
|
return n;
|
|
5747
5808
|
}
|
|
5748
|
-
async function
|
|
5749
|
-
let r = await
|
|
5750
|
-
endpoint: `${
|
|
5809
|
+
async function Dl(e, t, n) {
|
|
5810
|
+
let r = await Ol(e, "hook delete", {
|
|
5811
|
+
endpoint: `${wl(t)}/${n}`,
|
|
5751
5812
|
method: "DELETE"
|
|
5752
5813
|
});
|
|
5753
|
-
r.status != 404 &&
|
|
5814
|
+
r.status != 404 && kl(r, "hook delete");
|
|
5754
5815
|
}
|
|
5755
|
-
async function
|
|
5816
|
+
async function Ol(e, t, n) {
|
|
5756
5817
|
try {
|
|
5757
5818
|
return await e.connector.execute(n, e.signal);
|
|
5758
5819
|
} catch (e) {
|
|
5759
5820
|
throw e instanceof r ? e : new a(`GitLab ${t} request failed.`, { cause: e });
|
|
5760
5821
|
}
|
|
5761
5822
|
}
|
|
5762
|
-
function
|
|
5823
|
+
function kl(e, t) {
|
|
5763
5824
|
if (!(e.status >= 200 && e.status < 300)) throw e.status == 401 || e.status == 403 ? new r(`GitLab ${t} rejected the Connection.`) : [
|
|
5764
5825
|
400,
|
|
5765
5826
|
404,
|
|
5766
5827
|
422
|
|
5767
5828
|
].includes(e.status) ? new i(`GitLab ${t} rejected the subscription.`) : new a(`GitLab ${t} failed with status ${e.status}.`);
|
|
5768
5829
|
}
|
|
5769
|
-
function
|
|
5770
|
-
let t =
|
|
5830
|
+
function Al(e) {
|
|
5831
|
+
let t = Pl(e)?.id;
|
|
5771
5832
|
if (typeof t != "number" && typeof t != "string") throw new a("GitLab hook response is missing its ID.");
|
|
5772
5833
|
return String(t);
|
|
5773
5834
|
}
|
|
5774
|
-
function
|
|
5835
|
+
function jl(e) {
|
|
5775
5836
|
if (e == null) throw new i("GitLab Integration state is missing.");
|
|
5776
5837
|
return e;
|
|
5777
5838
|
}
|
|
5778
|
-
function
|
|
5839
|
+
function Ml(e) {
|
|
5779
5840
|
let t = e.subscription.hookId;
|
|
5780
5841
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
5781
5842
|
}
|
|
5782
|
-
function
|
|
5843
|
+
function Nl(e) {
|
|
5783
5844
|
return new Date(e.getTime() + 2592e6);
|
|
5784
5845
|
}
|
|
5785
|
-
function
|
|
5846
|
+
function Pl(e) {
|
|
5786
5847
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
5787
5848
|
}
|
|
5788
5849
|
//#endregion
|
|
5789
5850
|
//#region src/trigger/providers/gmail/on-message-received.ts
|
|
5790
|
-
var
|
|
5851
|
+
var Fl = 25, Il = 5, Ll = {
|
|
5791
5852
|
snapshot: {
|
|
5792
5853
|
configSchema: {
|
|
5793
5854
|
additionalProperties: !1,
|
|
@@ -5812,7 +5873,7 @@ var jl = 25, Ml = 5, Nl = {
|
|
|
5812
5873
|
type: "array"
|
|
5813
5874
|
},
|
|
5814
5875
|
maxMessagesPerPoll: {
|
|
5815
|
-
default:
|
|
5876
|
+
default: Fl,
|
|
5816
5877
|
maximum: 100,
|
|
5817
5878
|
minimum: 1,
|
|
5818
5879
|
type: "integer"
|
|
@@ -5883,20 +5944,20 @@ var jl = 25, Ml = 5, Nl = {
|
|
|
5883
5944
|
type: "poll"
|
|
5884
5945
|
},
|
|
5885
5946
|
async poll(e) {
|
|
5886
|
-
let t =
|
|
5947
|
+
let t = Rl(e.config);
|
|
5887
5948
|
if (e.checkpoint === null) return {
|
|
5888
|
-
checkpoint: { historyId: await
|
|
5949
|
+
checkpoint: { historyId: await zl(e) },
|
|
5889
5950
|
events: []
|
|
5890
5951
|
};
|
|
5891
|
-
let n =
|
|
5952
|
+
let n = Bl(e.checkpoint), r = await Vl(e, t.labelNamesOrIds), { candidates: i, lastPage: a } = await Hl(e, n, r, t.maxMessagesPerPoll), o = Ul(n.historyId, a), s = [], c = 0;
|
|
5892
5953
|
for (let n of i) {
|
|
5893
|
-
let i = await
|
|
5954
|
+
let i = await Wl(e, n.id);
|
|
5894
5955
|
if (i != null) {
|
|
5895
|
-
if (!await
|
|
5956
|
+
if (!await Gl(e, i, t, r)) {
|
|
5896
5957
|
c += 1;
|
|
5897
5958
|
continue;
|
|
5898
5959
|
}
|
|
5899
|
-
s.push(
|
|
5960
|
+
s.push(Jl(i));
|
|
5900
5961
|
}
|
|
5901
5962
|
}
|
|
5902
5963
|
return {
|
|
@@ -5907,39 +5968,39 @@ var jl = 25, Ml = 5, Nl = {
|
|
|
5907
5968
|
};
|
|
5908
5969
|
}
|
|
5909
5970
|
};
|
|
5910
|
-
function
|
|
5971
|
+
function Rl(e) {
|
|
5911
5972
|
return {
|
|
5912
5973
|
includeDrafts: e.includeDrafts ?? !1,
|
|
5913
5974
|
includeSpamAndTrash: e.includeSpamAndTrash ?? !1,
|
|
5914
5975
|
labelNamesOrIds: e.labelNamesOrIds ?? [],
|
|
5915
|
-
maxMessagesPerPoll: e.maxMessagesPerPoll ??
|
|
5976
|
+
maxMessagesPerPoll: e.maxMessagesPerPoll ?? Fl,
|
|
5916
5977
|
readStatus: e.readStatus ?? "All",
|
|
5917
5978
|
search: (e.search ?? "").trim(),
|
|
5918
5979
|
sender: (e.sender ?? "").trim()
|
|
5919
5980
|
};
|
|
5920
5981
|
}
|
|
5921
|
-
async function
|
|
5922
|
-
let t = await
|
|
5923
|
-
|
|
5924
|
-
let r =
|
|
5982
|
+
async function zl(e) {
|
|
5983
|
+
let t = await Yl(e, "/users/me/profile");
|
|
5984
|
+
Xl(t, "profile fetch");
|
|
5985
|
+
let r = J(t.data)?.historyId;
|
|
5925
5986
|
if (typeof r != "string" || r.length == 0) throw new n("Gmail profile historyId is missing.");
|
|
5926
5987
|
return r;
|
|
5927
5988
|
}
|
|
5928
|
-
function
|
|
5929
|
-
let n =
|
|
5989
|
+
function Bl(t) {
|
|
5990
|
+
let n = J(t);
|
|
5930
5991
|
if (typeof n?.historyId != "string" || n.historyId.length == 0) throw new e("Gmail checkpoint historyId is missing; recreate the Trigger.");
|
|
5931
5992
|
return {
|
|
5932
5993
|
historyId: n.historyId,
|
|
5933
5994
|
...typeof n.pageToken == "string" ? { pageToken: n.pageToken } : {}
|
|
5934
5995
|
};
|
|
5935
5996
|
}
|
|
5936
|
-
async function
|
|
5997
|
+
async function Vl(t, n) {
|
|
5937
5998
|
if (n.length == 0) return [];
|
|
5938
|
-
let r = await
|
|
5939
|
-
|
|
5940
|
-
let i =
|
|
5999
|
+
let r = await Yl(t, "/users/me/labels");
|
|
6000
|
+
Xl(r, "labels list");
|
|
6001
|
+
let i = J(r.data)?.labels, a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
5941
6002
|
if (Array.isArray(i)) for (let e of i) {
|
|
5942
|
-
let t =
|
|
6003
|
+
let t = J(e);
|
|
5943
6004
|
typeof t?.id == "string" && t.id.length != 0 && (a.add(t.id), typeof t.name == "string" && t.name.length > 0 && o.set(t.name.toLowerCase(), t.id));
|
|
5944
6005
|
}
|
|
5945
6006
|
return [...new Set(n.map((t) => {
|
|
@@ -5948,10 +6009,10 @@ async function Ll(t, n) {
|
|
|
5948
6009
|
return n;
|
|
5949
6010
|
}))];
|
|
5950
6011
|
}
|
|
5951
|
-
async function
|
|
6012
|
+
async function Hl(t, n, r, i) {
|
|
5952
6013
|
let a = /* @__PURE__ */ new Map(), o = n.pageToken, s = {};
|
|
5953
|
-
for (let c = 0; c <
|
|
5954
|
-
let c = await
|
|
6014
|
+
for (let c = 0; c < Il; c += 1) {
|
|
6015
|
+
let c = await Yl(t, "/users/me/history", {
|
|
5955
6016
|
historyTypes: "messageAdded",
|
|
5956
6017
|
labelId: r[0],
|
|
5957
6018
|
maxResults: i,
|
|
@@ -5959,7 +6020,7 @@ async function Rl(t, n, r, i) {
|
|
|
5959
6020
|
startHistoryId: n.historyId
|
|
5960
6021
|
});
|
|
5961
6022
|
if (c.status == 404) throw new e("Gmail history checkpoint expired; recreate the Trigger.");
|
|
5962
|
-
|
|
6023
|
+
Xl(c, "history list"), s = J(c.data) ?? {};
|
|
5963
6024
|
for (let e of s.history ?? []) for (let t of e.messagesAdded ?? []) {
|
|
5964
6025
|
let e = t.message?.id;
|
|
5965
6026
|
e != null && e.length > 0 && !a.has(e) && a.set(e, { id: e });
|
|
@@ -5971,7 +6032,7 @@ async function Rl(t, n, r, i) {
|
|
|
5971
6032
|
lastPage: s
|
|
5972
6033
|
};
|
|
5973
6034
|
}
|
|
5974
|
-
function
|
|
6035
|
+
function Ul(e, t) {
|
|
5975
6036
|
if (t.nextPageToken) return {
|
|
5976
6037
|
checkpoint: {
|
|
5977
6038
|
historyId: e,
|
|
@@ -5985,32 +6046,32 @@ function zl(e, t) {
|
|
|
5985
6046
|
hasMore: !1
|
|
5986
6047
|
};
|
|
5987
6048
|
}
|
|
5988
|
-
async function
|
|
5989
|
-
let n = await
|
|
5990
|
-
return n.status == 404 ? null : (
|
|
6049
|
+
async function Wl(e, t) {
|
|
6050
|
+
let n = await Yl(e, `/users/me/messages/${encodeURIComponent(t)}`, { format: "metadata" });
|
|
6051
|
+
return n.status == 404 ? null : (Xl(n, "message metadata fetch"), J(n.data) ?? null);
|
|
5991
6052
|
}
|
|
5992
|
-
async function
|
|
6053
|
+
async function Gl(e, t, n, r) {
|
|
5993
6054
|
let i = t.labelIds ?? [];
|
|
5994
6055
|
if (!n.includeSpamAndTrash && (i.includes("SPAM") || i.includes("TRASH")) || !n.includeDrafts && i.includes("DRAFT") || n.readStatus == "Unread" && !i.includes("UNREAD") || n.readStatus == "Read" && i.includes("UNREAD") || !r.every((e) => i.includes(e))) return !1;
|
|
5995
|
-
let a =
|
|
5996
|
-
return a.length == 0 || await
|
|
6056
|
+
let a = Kl(n);
|
|
6057
|
+
return a.length == 0 || await ql(e, t, a, n.includeSpamAndTrash);
|
|
5997
6058
|
}
|
|
5998
|
-
function
|
|
6059
|
+
function Kl(e) {
|
|
5999
6060
|
let t = e.search.length == 0 ? [] : [e.search], n = e.sender.replaceAll("\"", "").trim();
|
|
6000
6061
|
return n.length > 0 && t.push(`from:${/\s/.test(n) ? `"${n}"` : n}`), t.join(" ");
|
|
6001
6062
|
}
|
|
6002
|
-
async function
|
|
6003
|
-
let i =
|
|
6063
|
+
async function ql(e, t, n, r) {
|
|
6064
|
+
let i = Zl(t.payload?.headers ?? [], "Message-ID").replace(/^</, "").replace(/>$/, "");
|
|
6004
6065
|
if (i.length == 0) return !1;
|
|
6005
|
-
let a = await
|
|
6066
|
+
let a = await Yl(e, "/users/me/messages", {
|
|
6006
6067
|
includeSpamTrash: r ? "true" : void 0,
|
|
6007
6068
|
q: `${n} rfc822msgid:${i}`
|
|
6008
6069
|
});
|
|
6009
|
-
|
|
6010
|
-
let o =
|
|
6011
|
-
return Array.isArray(o) && o.some((e) =>
|
|
6070
|
+
Xl(a, "query match");
|
|
6071
|
+
let o = J(a.data)?.messages;
|
|
6072
|
+
return Array.isArray(o) && o.some((e) => J(e)?.id === t.id);
|
|
6012
6073
|
}
|
|
6013
|
-
function
|
|
6074
|
+
function Jl(e) {
|
|
6014
6075
|
let t = e.payload?.headers ?? [];
|
|
6015
6076
|
return {
|
|
6016
6077
|
dedupeKey: e.id,
|
|
@@ -6018,15 +6079,15 @@ function Wl(e) {
|
|
|
6018
6079
|
historyId: e.historyId ?? null,
|
|
6019
6080
|
labelIds: e.labelIds ?? [],
|
|
6020
6081
|
messageId: e.id,
|
|
6021
|
-
messageTimestamp:
|
|
6022
|
-
sender:
|
|
6023
|
-
subject:
|
|
6082
|
+
messageTimestamp: Ql(e.internalDate, Zl(t, "Date")),
|
|
6083
|
+
sender: Zl(t, "From"),
|
|
6084
|
+
subject: Zl(t, "Subject"),
|
|
6024
6085
|
threadId: e.threadId ?? "",
|
|
6025
|
-
to:
|
|
6086
|
+
to: Zl(t, "To")
|
|
6026
6087
|
}
|
|
6027
6088
|
};
|
|
6028
6089
|
}
|
|
6029
|
-
async function
|
|
6090
|
+
async function Yl(e, t, r = {}) {
|
|
6030
6091
|
try {
|
|
6031
6092
|
return await e.connector.execute({
|
|
6032
6093
|
endpoint: t,
|
|
@@ -6037,13 +6098,13 @@ async function Gl(e, t, r = {}) {
|
|
|
6037
6098
|
throw new n(`Gmail proxy request to ${t} failed.`, { cause: e });
|
|
6038
6099
|
}
|
|
6039
6100
|
}
|
|
6040
|
-
function
|
|
6101
|
+
function Xl(e, r) {
|
|
6041
6102
|
if (!(e.status >= 200 && e.status < 300)) throw e.status == 401 || e.status == 403 ? new t(`Gmail ${r} rejected the Connection.`) : new n(`Gmail ${r} failed with status ${e.status}.`);
|
|
6042
6103
|
}
|
|
6043
|
-
function
|
|
6104
|
+
function Zl(e, t) {
|
|
6044
6105
|
return e.find((e) => e.name.toLowerCase() == t.toLowerCase())?.value ?? "";
|
|
6045
6106
|
}
|
|
6046
|
-
function
|
|
6107
|
+
function Ql(e, t) {
|
|
6047
6108
|
let n = e == null ? NaN : Number(e);
|
|
6048
6109
|
if (Number.isFinite(n)) {
|
|
6049
6110
|
let e = new Date(n);
|
|
@@ -6052,21 +6113,21 @@ function Jl(e, t) {
|
|
|
6052
6113
|
let r = Date.parse(t);
|
|
6053
6114
|
return Number.isNaN(r) ? "" : new Date(r).toISOString();
|
|
6054
6115
|
}
|
|
6055
|
-
function
|
|
6116
|
+
function J(e) {
|
|
6056
6117
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
6057
6118
|
}
|
|
6058
6119
|
//#endregion
|
|
6059
6120
|
//#region src/trigger/providers/google-calendar/on-event-changed.ts
|
|
6060
|
-
var
|
|
6121
|
+
var $l = [
|
|
6061
6122
|
"created",
|
|
6062
6123
|
"updated",
|
|
6063
6124
|
"cancelled"
|
|
6064
|
-
],
|
|
6125
|
+
], eu = /* @__PURE__ */ new Set([
|
|
6065
6126
|
"rateLimitExceeded",
|
|
6066
6127
|
"userRateLimitExceeded",
|
|
6067
6128
|
"quotaExceeded",
|
|
6068
6129
|
"usageLimits"
|
|
6069
|
-
]),
|
|
6130
|
+
]), tu = {
|
|
6070
6131
|
snapshot: {
|
|
6071
6132
|
configSchema: {
|
|
6072
6133
|
additionalProperties: !1,
|
|
@@ -6077,9 +6138,9 @@ var Yl = [
|
|
|
6077
6138
|
type: "string"
|
|
6078
6139
|
},
|
|
6079
6140
|
changes: {
|
|
6080
|
-
default:
|
|
6141
|
+
default: $l,
|
|
6081
6142
|
items: {
|
|
6082
|
-
enum:
|
|
6143
|
+
enum: $l,
|
|
6083
6144
|
type: "string"
|
|
6084
6145
|
},
|
|
6085
6146
|
minItems: 1,
|
|
@@ -6118,7 +6179,7 @@ var Yl = [
|
|
|
6118
6179
|
},
|
|
6119
6180
|
calendarId: { type: "string" },
|
|
6120
6181
|
changeType: {
|
|
6121
|
-
enum:
|
|
6182
|
+
enum: $l,
|
|
6122
6183
|
type: "string"
|
|
6123
6184
|
},
|
|
6124
6185
|
created: { type: ["string", "null"] },
|
|
@@ -6169,22 +6230,22 @@ var Yl = [
|
|
|
6169
6230
|
type: "poll"
|
|
6170
6231
|
},
|
|
6171
6232
|
async poll(e) {
|
|
6172
|
-
let t =
|
|
6173
|
-
if (e.checkpoint === null) return
|
|
6174
|
-
let n =
|
|
6175
|
-
return n.calendarId === t.calendarId ? "seedTimeMin" in n ?
|
|
6233
|
+
let t = nu(e.config);
|
|
6234
|
+
if (e.checkpoint === null) return iu(e, t, e.now.toISOString());
|
|
6235
|
+
let n = ru(e.checkpoint);
|
|
6236
|
+
return n.calendarId === t.calendarId ? "seedTimeMin" in n ? iu(e, t, n.seedTimeMin, n.pageToken) : au(e, t, n) : iu(e, t, e.now.toISOString());
|
|
6176
6237
|
}
|
|
6177
6238
|
};
|
|
6178
|
-
function
|
|
6239
|
+
function nu(e) {
|
|
6179
6240
|
return {
|
|
6180
6241
|
calendarId: e.calendarId,
|
|
6181
|
-
changes: new Set(e.changes ??
|
|
6242
|
+
changes: new Set(e.changes ?? $l),
|
|
6182
6243
|
matchTerm: (e.matchTerm ?? "").trim(),
|
|
6183
6244
|
maxEventsPerPoll: e.maxEventsPerPoll ?? 100
|
|
6184
6245
|
};
|
|
6185
6246
|
}
|
|
6186
|
-
function
|
|
6187
|
-
let n =
|
|
6247
|
+
function ru(t) {
|
|
6248
|
+
let n = Y(t), r = typeof n?.pageToken == "string" ? n.pageToken : void 0, i = typeof n?.calendarId == "string" ? n.calendarId : void 0;
|
|
6188
6249
|
if (typeof n?.syncToken == "string" && n.syncToken.length > 0) return {
|
|
6189
6250
|
calendarId: i,
|
|
6190
6251
|
...r == null ? {} : { pageToken: r },
|
|
@@ -6197,25 +6258,25 @@ function $l(t) {
|
|
|
6197
6258
|
};
|
|
6198
6259
|
throw new e("Google Calendar checkpoint is invalid; recreate the Trigger.");
|
|
6199
6260
|
}
|
|
6200
|
-
async function
|
|
6261
|
+
async function iu(e, t, r, i) {
|
|
6201
6262
|
let a = i;
|
|
6202
6263
|
for (let i = 0; i < 2; i += 1) {
|
|
6203
|
-
let i = await
|
|
6264
|
+
let i = await lu(e, t.calendarId, {
|
|
6204
6265
|
maxResults: 2500,
|
|
6205
6266
|
pageToken: a,
|
|
6206
6267
|
showDeleted: "true",
|
|
6207
6268
|
singleEvents: "false",
|
|
6208
6269
|
timeMin: r
|
|
6209
6270
|
});
|
|
6210
|
-
if (a != null &&
|
|
6271
|
+
if (a != null && du(i)) return {
|
|
6211
6272
|
checkpoint: {
|
|
6212
6273
|
calendarId: t.calendarId,
|
|
6213
6274
|
seedTimeMin: r
|
|
6214
6275
|
},
|
|
6215
6276
|
events: []
|
|
6216
6277
|
};
|
|
6217
|
-
|
|
6218
|
-
let o =
|
|
6278
|
+
uu(e, i, "seed full sync");
|
|
6279
|
+
let o = Y(i.data) ?? {};
|
|
6219
6280
|
if (o.nextSyncToken) return {
|
|
6220
6281
|
checkpoint: {
|
|
6221
6282
|
calendarId: t.calendarId,
|
|
@@ -6236,17 +6297,17 @@ async function eu(e, t, r, i) {
|
|
|
6236
6297
|
hasMore: !0
|
|
6237
6298
|
};
|
|
6238
6299
|
}
|
|
6239
|
-
async function
|
|
6300
|
+
async function au(e, t, r) {
|
|
6240
6301
|
let i = [], a = 0, o = r.pageToken;
|
|
6241
6302
|
for (let s = 0; s < 5; s += 1) {
|
|
6242
|
-
let s = await
|
|
6303
|
+
let s = await lu(e, t.calendarId, {
|
|
6243
6304
|
maxResults: t.maxEventsPerPoll,
|
|
6244
6305
|
pageToken: o,
|
|
6245
6306
|
showDeleted: "true",
|
|
6246
6307
|
singleEvents: "false",
|
|
6247
6308
|
syncToken: r.syncToken
|
|
6248
6309
|
});
|
|
6249
|
-
if (o != null &&
|
|
6310
|
+
if (o != null && du(s)) return {
|
|
6250
6311
|
checkpoint: {
|
|
6251
6312
|
calendarId: t.calendarId,
|
|
6252
6313
|
syncToken: r.syncToken
|
|
@@ -6254,16 +6315,16 @@ async function tu(e, t, r) {
|
|
|
6254
6315
|
events: i,
|
|
6255
6316
|
filtered: a
|
|
6256
6317
|
};
|
|
6257
|
-
|
|
6258
|
-
let c =
|
|
6318
|
+
uu(e, s, "incremental sync");
|
|
6319
|
+
let c = Y(s.data) ?? {};
|
|
6259
6320
|
for (let e of c.items ?? []) {
|
|
6260
6321
|
if (e.id == null || e.id.length == 0) continue;
|
|
6261
|
-
let n =
|
|
6262
|
-
if (!t.changes.has(n) || !
|
|
6322
|
+
let n = ou(e);
|
|
6323
|
+
if (!t.changes.has(n) || !su(e, t.matchTerm)) {
|
|
6263
6324
|
a += 1;
|
|
6264
6325
|
continue;
|
|
6265
6326
|
}
|
|
6266
|
-
i.push(
|
|
6327
|
+
i.push(cu(e, e.id, n, t.calendarId));
|
|
6267
6328
|
}
|
|
6268
6329
|
if (c.nextSyncToken) return {
|
|
6269
6330
|
checkpoint: {
|
|
@@ -6287,12 +6348,12 @@ async function tu(e, t, r) {
|
|
|
6287
6348
|
hasMore: !0
|
|
6288
6349
|
};
|
|
6289
6350
|
}
|
|
6290
|
-
function
|
|
6351
|
+
function ou(e) {
|
|
6291
6352
|
if (e.status == "cancelled") return "cancelled";
|
|
6292
|
-
let t =
|
|
6353
|
+
let t = hu(e.created), n = hu(e.updated);
|
|
6293
6354
|
return t != null && t == n ? "created" : "updated";
|
|
6294
6355
|
}
|
|
6295
|
-
function
|
|
6356
|
+
function su(e, t) {
|
|
6296
6357
|
if (t.length == 0) return !0;
|
|
6297
6358
|
let n = t.toLowerCase();
|
|
6298
6359
|
return [
|
|
@@ -6302,14 +6363,14 @@ function ru(e, t) {
|
|
|
6302
6363
|
...(e.attendees ?? []).map(({ email: e }) => e)
|
|
6303
6364
|
].some((e) => typeof e == "string" && e.toLowerCase().includes(n));
|
|
6304
6365
|
}
|
|
6305
|
-
function
|
|
6366
|
+
function cu(e, t, n, r) {
|
|
6306
6367
|
return {
|
|
6307
6368
|
dedupeKey: `${t}:${e.updated ?? e.etag ?? ""}`,
|
|
6308
6369
|
payload: {
|
|
6309
6370
|
attendeeEmails: (e.attendees ?? []).flatMap(({ email: e }) => e == null || e.length == 0 ? [] : [e]),
|
|
6310
6371
|
calendarId: r,
|
|
6311
6372
|
changeType: n,
|
|
6312
|
-
created:
|
|
6373
|
+
created: mu(e.created),
|
|
6313
6374
|
creatorEmail: e.creator?.email ?? null,
|
|
6314
6375
|
description: e.description ?? null,
|
|
6315
6376
|
end: e.end ?? null,
|
|
@@ -6323,11 +6384,11 @@ function iu(e, t, n, r) {
|
|
|
6323
6384
|
start: e.start ?? null,
|
|
6324
6385
|
status: e.status ?? "",
|
|
6325
6386
|
summary: e.summary ?? null,
|
|
6326
|
-
updated:
|
|
6387
|
+
updated: mu(e.updated)
|
|
6327
6388
|
}
|
|
6328
6389
|
};
|
|
6329
6390
|
}
|
|
6330
|
-
async function
|
|
6391
|
+
async function lu(e, t, r) {
|
|
6331
6392
|
let i = `/calendars/${encodeURIComponent(t)}/events`;
|
|
6332
6393
|
try {
|
|
6333
6394
|
return await e.connector.execute({
|
|
@@ -6339,40 +6400,40 @@ async function au(e, t, r) {
|
|
|
6339
6400
|
throw new n(`Google Calendar proxy request to ${i} failed.`, { cause: e });
|
|
6340
6401
|
}
|
|
6341
6402
|
}
|
|
6342
|
-
function
|
|
6343
|
-
if (!(i.status >= 200 && i.status < 300)) throw i.status == 410 || i.status == 400 &&
|
|
6403
|
+
function uu(r, i, a) {
|
|
6404
|
+
if (!(i.status >= 200 && i.status < 300)) throw i.status == 410 || i.status == 400 && pu(i.data) ? new e("Google Calendar sync token expired; recreate the Trigger.") : i.status == 400 || i.status == 404 && r.checkpoint === null ? new e(`Google Calendar ${a} rejected the configuration.`) : i.status == 401 ? new t(`Google Calendar ${a} rejected the Connection.`) : i.status == 403 ? fu(i.data).some((e) => eu.has(e)) ? new n(`Google Calendar ${a} was rate limited.`) : new t(`Google Calendar ${a} rejected the Connection.`) : new n(`Google Calendar ${a} failed with status ${i.status}.`);
|
|
6344
6405
|
}
|
|
6345
|
-
function
|
|
6346
|
-
return e.status == 400 && !
|
|
6406
|
+
function du(e) {
|
|
6407
|
+
return e.status == 400 && !pu(e.data);
|
|
6347
6408
|
}
|
|
6348
|
-
function
|
|
6349
|
-
let t =
|
|
6409
|
+
function fu(e) {
|
|
6410
|
+
let t = Y(Y(e)?.error)?.errors;
|
|
6350
6411
|
return Array.isArray(t) ? t.flatMap((e) => {
|
|
6351
|
-
let t =
|
|
6412
|
+
let t = Y(e)?.reason;
|
|
6352
6413
|
return typeof t == "string" ? [t] : [];
|
|
6353
6414
|
}) : [];
|
|
6354
6415
|
}
|
|
6355
|
-
function
|
|
6356
|
-
if (
|
|
6357
|
-
let t =
|
|
6416
|
+
function pu(e) {
|
|
6417
|
+
if (fu(e).includes("fullSyncRequired")) return !0;
|
|
6418
|
+
let t = Y(Y(e)?.error)?.message;
|
|
6358
6419
|
return typeof t == "string" && t.includes("fullSyncRequired");
|
|
6359
6420
|
}
|
|
6360
|
-
function
|
|
6421
|
+
function mu(e) {
|
|
6361
6422
|
if (e == null || e.length == 0) return null;
|
|
6362
6423
|
let t = Date.parse(e);
|
|
6363
6424
|
return Number.isNaN(t) ? null : new Date(t).toISOString();
|
|
6364
6425
|
}
|
|
6365
|
-
function
|
|
6426
|
+
function hu(e) {
|
|
6366
6427
|
if (e == null || e.length == 0) return null;
|
|
6367
6428
|
let t = Date.parse(e);
|
|
6368
6429
|
return Number.isNaN(t) ? null : Math.floor(t / 1e3);
|
|
6369
6430
|
}
|
|
6370
|
-
function
|
|
6431
|
+
function Y(e) {
|
|
6371
6432
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
6372
6433
|
}
|
|
6373
6434
|
//#endregion
|
|
6374
6435
|
//#region src/trigger/providers/google-drive/changes.ts
|
|
6375
|
-
var
|
|
6436
|
+
var gu = 6012e5, _u = 36e5, vu = 6e4, yu = 6e4, bu = 2, xu = 100, Su = new TextEncoder(), Cu = "nextPageToken,newStartPageToken,changes(fileId,kind,changeType,removed,time,driveId,file(id,name,mimeType,webViewLink,createdTime,modifiedTime,size,driveId,parents,shared,starred,trashed))", wu = {
|
|
6376
6437
|
configSchema: {
|
|
6377
6438
|
additionalProperties: !1,
|
|
6378
6439
|
description: "Configuration for googledrive.changes_detected.",
|
|
@@ -6399,7 +6460,7 @@ var fu = 6012e5, pu = 36e5, mu = 6e4, hu = 6e4, gu = 2, _u = 100, vu = new TextE
|
|
|
6399
6460
|
type: "boolean"
|
|
6400
6461
|
},
|
|
6401
6462
|
pageSize: {
|
|
6402
|
-
default:
|
|
6463
|
+
default: xu,
|
|
6403
6464
|
description: "Maximum changes included in one Flow Run.",
|
|
6404
6465
|
maximum: 100,
|
|
6405
6466
|
minimum: 1,
|
|
@@ -6481,16 +6542,16 @@ var fu = 6012e5, pu = 36e5, mu = 6e4, hu = 6e4, gu = 2, _u = 100, vu = new TextE
|
|
|
6481
6542
|
},
|
|
6482
6543
|
provider: "googledrive",
|
|
6483
6544
|
type: "integration"
|
|
6484
|
-
},
|
|
6545
|
+
}, Tu = {
|
|
6485
6546
|
initialState: {
|
|
6486
6547
|
checkpoint: null,
|
|
6487
6548
|
subscription: { channels: [] }
|
|
6488
6549
|
},
|
|
6489
|
-
snapshot:
|
|
6550
|
+
snapshot: wu,
|
|
6490
6551
|
async receive(e) {
|
|
6491
|
-
let t = await
|
|
6552
|
+
let t = await Gu(e);
|
|
6492
6553
|
if (t.outcome != "wake") return t;
|
|
6493
|
-
let n =
|
|
6554
|
+
let n = Eu(e.state), r = e.header("x-goog-resource-state");
|
|
6494
6555
|
if (!e.admit) return e.current ? {
|
|
6495
6556
|
body: "",
|
|
6496
6557
|
contentType: "text/plain",
|
|
@@ -6504,12 +6565,12 @@ var fu = 6012e5, pu = 36e5, mu = 6e4, hu = 6e4, gu = 2, _u = 100, vu = new TextE
|
|
|
6504
6565
|
outcome: "ignored",
|
|
6505
6566
|
reason: "The Team cannot admit Trigger events."
|
|
6506
6567
|
};
|
|
6507
|
-
let i = await
|
|
6568
|
+
let i = await Pu(e, n.checkpoint), a = {
|
|
6508
6569
|
changedTypes: (e.header("x-goog-changed") ?? "").split(",").map((e) => e.trim()).filter((e) => e.length > 0),
|
|
6509
6570
|
messageNumber: e.header("x-goog-message-number") ?? null,
|
|
6510
6571
|
resourceState: r,
|
|
6511
6572
|
resourceUri: e.header("x-goog-resource-uri") ?? null
|
|
6512
|
-
}, o = i.changes.map((e) =>
|
|
6573
|
+
}, o = i.changes.map((e) => Bu(e, a)), s = {
|
|
6513
6574
|
checkpoint: i.checkpoint,
|
|
6514
6575
|
continue: i.hasMore,
|
|
6515
6576
|
dedupeKey: i.dedupeKey
|
|
@@ -6525,52 +6586,52 @@ var fu = 6012e5, pu = 36e5, mu = 6e4, hu = 6e4, gu = 2, _u = 100, vu = new TextE
|
|
|
6525
6586
|
};
|
|
6526
6587
|
},
|
|
6527
6588
|
async reconcile(e) {
|
|
6528
|
-
let t =
|
|
6529
|
-
if (i.length != n.length && (n = i, await
|
|
6589
|
+
let t = Eu(e.state), n = ku(t), r = e.now.getTime(), i = n.filter((e) => Date.parse(e.expiration) > r);
|
|
6590
|
+
if (i.length != n.length && (n = i, await X(t, n, e.now)), !e.active) return await ju(e, n);
|
|
6530
6591
|
let a = n.filter((e) => e.state == "creating" && e.resourceId != null).toSorted((e, t) => Date.parse(t.createdAt) - Date.parse(e.createdAt))[0];
|
|
6531
6592
|
a != null && (n = n.map((e) => ({
|
|
6532
6593
|
...e,
|
|
6533
6594
|
state: e.id == a.id ? "active" : "retiring"
|
|
6534
|
-
})), await
|
|
6535
|
-
let o = n.find((e) => e.state == "active"), s = n.filter((e) => e.state == "creating").filter((e) => Date.parse(e.createdAt) +
|
|
6595
|
+
})), await X(t, n, e.now));
|
|
6596
|
+
let o = n.find((e) => e.state == "active"), s = n.filter((e) => e.state == "creating").filter((e) => Date.parse(e.createdAt) + vu <= r);
|
|
6536
6597
|
if (s.length > 0) {
|
|
6537
6598
|
let r = new Set(s.map((e) => e.id));
|
|
6538
6599
|
n = n.map((e) => r.has(e.id) ? {
|
|
6539
6600
|
...e,
|
|
6540
6601
|
state: "retiring"
|
|
6541
|
-
} : e), await
|
|
6602
|
+
} : e), await X(t, n, e.now);
|
|
6542
6603
|
}
|
|
6543
6604
|
if (o = n.find((e) => e.state == "active"), o != null) {
|
|
6544
6605
|
try {
|
|
6545
|
-
n = await
|
|
6606
|
+
n = await Mu(e, n);
|
|
6546
6607
|
} catch {
|
|
6547
6608
|
return { outcome: "ready" };
|
|
6548
6609
|
}
|
|
6549
|
-
if (o = n.find((e) => e.state == "active"), o != null && Date.parse(o.expiration) -
|
|
6610
|
+
if (o = n.find((e) => e.state == "active"), o != null && Date.parse(o.expiration) - _u > r) return await X(t, n, Vu(n, e.now)), { outcome: "ready" };
|
|
6550
6611
|
}
|
|
6551
|
-
return n.some((e) => e.state == "creating") || n.filter((e) => e.resourceId == null).length >=
|
|
6612
|
+
return n.some((e) => e.state == "creating") || n.filter((e) => e.resourceId == null).length >= bu ? (await X(t, n, Vu(n, e.now)), { outcome: o == null ? "pending" : "ready" }) : await Au(e, n);
|
|
6552
6613
|
}
|
|
6553
6614
|
};
|
|
6554
|
-
function
|
|
6615
|
+
function Eu(e) {
|
|
6555
6616
|
if (e == null) throw new i("Google Drive Integration state is missing.");
|
|
6556
6617
|
return e;
|
|
6557
6618
|
}
|
|
6558
|
-
function
|
|
6619
|
+
function Du(e) {
|
|
6559
6620
|
return {
|
|
6560
6621
|
...typeof e.driveId == "string" ? { driveId: e.driveId } : {},
|
|
6561
6622
|
includeCorpusRemovals: e.includeCorpusRemovals ?? !1,
|
|
6562
6623
|
includeItemsFromAllDrives: e.includeItemsFromAllDrives ?? !0,
|
|
6563
6624
|
includeRemoved: e.includeRemoved ?? !0,
|
|
6564
|
-
pageSize: e.pageSize ??
|
|
6625
|
+
pageSize: e.pageSize ?? xu,
|
|
6565
6626
|
restrictToMyDrive: e.restrictToMyDrive ?? !1
|
|
6566
6627
|
};
|
|
6567
6628
|
}
|
|
6568
|
-
function
|
|
6569
|
-
let t =
|
|
6629
|
+
function Ou(e) {
|
|
6630
|
+
let t = Q(e) ? Z(e.pageToken) : void 0;
|
|
6570
6631
|
if (t == null) throw new i("Google Drive checkpoint pageToken is missing.");
|
|
6571
6632
|
return t;
|
|
6572
6633
|
}
|
|
6573
|
-
function
|
|
6634
|
+
function ku(e) {
|
|
6574
6635
|
let t = e.subscription.channels;
|
|
6575
6636
|
if (!Array.isArray(t)) throw new i("Google Drive channel state is invalid.");
|
|
6576
6637
|
let n = t.map((e) => {
|
|
@@ -6593,24 +6654,24 @@ function Tu(e) {
|
|
|
6593
6654
|
if (new Set(n.map((e) => e.id)).size != n.length) throw new i("Google Drive channel IDs are duplicated.");
|
|
6594
6655
|
return n;
|
|
6595
6656
|
}
|
|
6596
|
-
async function
|
|
6597
|
-
let n =
|
|
6598
|
-
n.checkpoint === null ? (s = await
|
|
6657
|
+
async function Au(e, t) {
|
|
6658
|
+
let n = Eu(e.state), o = Du(e.config), s;
|
|
6659
|
+
n.checkpoint === null ? (s = await Nu(e), await n.saveCheckpoint({ pageToken: s })) : s = Ou(n.checkpoint);
|
|
6599
6660
|
let c = {
|
|
6600
6661
|
createdAt: e.now.toISOString(),
|
|
6601
|
-
expiration: new Date(e.now.getTime() +
|
|
6662
|
+
expiration: new Date(e.now.getTime() + gu).toISOString(),
|
|
6602
6663
|
id: crypto.randomUUID(),
|
|
6603
6664
|
state: "creating"
|
|
6604
6665
|
};
|
|
6605
|
-
t = [...t, c], await
|
|
6666
|
+
t = [...t, c], await X(n, t, new Date(e.now.getTime() + vu));
|
|
6606
6667
|
let l;
|
|
6607
6668
|
try {
|
|
6608
|
-
l = await
|
|
6669
|
+
l = await Iu(e, {
|
|
6609
6670
|
body: {
|
|
6610
6671
|
address: e.endpointUrl,
|
|
6611
6672
|
expiration: String(Date.parse(c.expiration)),
|
|
6612
6673
|
id: c.id,
|
|
6613
|
-
token: await
|
|
6674
|
+
token: await Hu(e.callbackSecret, c.id),
|
|
6614
6675
|
type: "web_hook"
|
|
6615
6676
|
},
|
|
6616
6677
|
endpoint: "/changes/watch",
|
|
@@ -6624,11 +6685,11 @@ async function Eu(e, t) {
|
|
|
6624
6685
|
}
|
|
6625
6686
|
}, "changes.watch");
|
|
6626
6687
|
} catch (a) {
|
|
6627
|
-
throw (a instanceof r || a instanceof i) && await
|
|
6688
|
+
throw (a instanceof r || a instanceof i) && await X(n, t.filter((e) => e.id != c.id), e.now), a;
|
|
6628
6689
|
}
|
|
6629
|
-
let u =
|
|
6690
|
+
let u = Z(l.resourceId);
|
|
6630
6691
|
if (u == null) throw new a("Google Drive changes.watch response is missing resourceId.");
|
|
6631
|
-
let d =
|
|
6692
|
+
let d = Wu(l.expiration) ?? c.expiration;
|
|
6632
6693
|
t = t.map((e) => e.id == c.id ? {
|
|
6633
6694
|
...e,
|
|
6634
6695
|
expiration: d,
|
|
@@ -6637,52 +6698,52 @@ async function Eu(e, t) {
|
|
|
6637
6698
|
} : e.state == "active" ? {
|
|
6638
6699
|
...e,
|
|
6639
6700
|
state: "retiring"
|
|
6640
|
-
} : e), await
|
|
6701
|
+
} : e), await X(n, t, Vu(t, e.now));
|
|
6641
6702
|
try {
|
|
6642
|
-
t = await
|
|
6703
|
+
t = await Mu(e, t);
|
|
6643
6704
|
} catch {
|
|
6644
6705
|
return { outcome: "ready" };
|
|
6645
6706
|
}
|
|
6646
|
-
return await
|
|
6707
|
+
return await X(n, t, Vu(t, e.now)), { outcome: "ready" };
|
|
6647
6708
|
}
|
|
6648
|
-
async function
|
|
6649
|
-
let n =
|
|
6709
|
+
async function ju(e, t) {
|
|
6710
|
+
let n = Eu(e.state);
|
|
6650
6711
|
return t.some((e) => e.state == "active" || e.state == "creating") && (t = t.map((e) => ({
|
|
6651
6712
|
...e,
|
|
6652
6713
|
state: "retiring"
|
|
6653
|
-
})), await
|
|
6714
|
+
})), await X(n, t, e.now)), t = await Mu(e, t), t.length == 0 ? { outcome: "ready" } : (await X(n, t, Vu(t, e.now)), { outcome: "pending" });
|
|
6654
6715
|
}
|
|
6655
|
-
async function
|
|
6656
|
-
let n =
|
|
6716
|
+
async function Mu(e, t) {
|
|
6717
|
+
let n = Eu(e.state);
|
|
6657
6718
|
for (let r of t) {
|
|
6658
6719
|
if (r.state != "retiring" && r.state != "stopping" || r.resourceId == null) continue;
|
|
6659
6720
|
let i = t.map((e) => e.id == r.id ? {
|
|
6660
6721
|
...e,
|
|
6661
6722
|
state: "stopping"
|
|
6662
6723
|
} : e);
|
|
6663
|
-
await
|
|
6724
|
+
await X(n, i, new Date(e.now.getTime() + yu)), await Fu(e, r), t = i.filter((e) => e.id != r.id), await X(n, t, e.now);
|
|
6664
6725
|
}
|
|
6665
6726
|
return t;
|
|
6666
6727
|
}
|
|
6667
|
-
async function
|
|
6668
|
-
let t =
|
|
6728
|
+
async function Nu(e) {
|
|
6729
|
+
let t = Du(e.config), n = await Iu(e, {
|
|
6669
6730
|
endpoint: "/changes/startPageToken",
|
|
6670
6731
|
method: "GET",
|
|
6671
6732
|
query: {
|
|
6672
6733
|
...t.driveId == null ? {} : { driveId: t.driveId },
|
|
6673
6734
|
supportsAllDrives: !0
|
|
6674
6735
|
}
|
|
6675
|
-
}, "changes.getStartPageToken"), r =
|
|
6736
|
+
}, "changes.getStartPageToken"), r = Q(n) ? Z(n.startPageToken) : void 0;
|
|
6676
6737
|
if (r == null) throw new a("Google Drive startPageToken response is invalid.");
|
|
6677
6738
|
return r;
|
|
6678
6739
|
}
|
|
6679
|
-
async function
|
|
6680
|
-
let n =
|
|
6740
|
+
async function Pu(e, t) {
|
|
6741
|
+
let n = Du(e.config), r = Ou(t), i = await Iu(e, {
|
|
6681
6742
|
endpoint: "/changes",
|
|
6682
6743
|
method: "GET",
|
|
6683
6744
|
query: {
|
|
6684
6745
|
...n.driveId == null ? {} : { driveId: n.driveId },
|
|
6685
|
-
fields:
|
|
6746
|
+
fields: Cu,
|
|
6686
6747
|
includeCorpusRemovals: n.includeCorpusRemovals,
|
|
6687
6748
|
includeItemsFromAllDrives: n.driveId != null || n.includeItemsFromAllDrives,
|
|
6688
6749
|
includeRemoved: n.includeCorpusRemovals || n.includeRemoved,
|
|
@@ -6692,10 +6753,10 @@ async function Au(e, t) {
|
|
|
6692
6753
|
supportsAllDrives: !0
|
|
6693
6754
|
}
|
|
6694
6755
|
}, "changes.list");
|
|
6695
|
-
for (let e of ["nextPageToken", "newStartPageToken"]) if (i[e] !== void 0 &&
|
|
6696
|
-
let o =
|
|
6756
|
+
for (let e of ["nextPageToken", "newStartPageToken"]) if (i[e] !== void 0 && Z(i[e]) == null) throw new a(`Google Drive changes response contains an invalid ${e}.`);
|
|
6757
|
+
let o = Z(i.nextPageToken), s = o ?? Z(i.newStartPageToken);
|
|
6697
6758
|
if (s == null) throw new a("Google Drive changes response is missing its next checkpoint.");
|
|
6698
|
-
if (i.changes != null && (!Array.isArray(i.changes) || !i.changes.every(
|
|
6759
|
+
if (i.changes != null && (!Array.isArray(i.changes) || !i.changes.every(Q))) throw new a("Google Drive changes response contains invalid changes.");
|
|
6699
6760
|
if (o === r) throw new a("Google Drive changes continuation did not advance.");
|
|
6700
6761
|
return {
|
|
6701
6762
|
changes: i.changes ?? [],
|
|
@@ -6704,8 +6765,8 @@ async function Au(e, t) {
|
|
|
6704
6765
|
hasMore: o != null
|
|
6705
6766
|
};
|
|
6706
6767
|
}
|
|
6707
|
-
async function
|
|
6708
|
-
let n = await
|
|
6768
|
+
async function Fu(e, t) {
|
|
6769
|
+
let n = await Lu(e, {
|
|
6709
6770
|
body: {
|
|
6710
6771
|
id: t.id,
|
|
6711
6772
|
resourceId: t.resourceId
|
|
@@ -6713,31 +6774,31 @@ async function ju(e, t) {
|
|
|
6713
6774
|
endpoint: "/channels/stop",
|
|
6714
6775
|
method: "POST"
|
|
6715
6776
|
});
|
|
6716
|
-
n.status >= 200 && n.status < 300 || n.status == 404 ||
|
|
6777
|
+
n.status >= 200 && n.status < 300 || n.status == 404 || Ru(n, "channels.stop");
|
|
6717
6778
|
}
|
|
6718
|
-
async function
|
|
6719
|
-
let r = await
|
|
6720
|
-
if (r.status >= 200 && r.status < 300 &&
|
|
6721
|
-
|
|
6779
|
+
async function Iu(e, t, n) {
|
|
6780
|
+
let r = await Lu(e, t);
|
|
6781
|
+
if (r.status >= 200 && r.status < 300 && Q(r.data)) return r.data;
|
|
6782
|
+
Ru(r, n);
|
|
6722
6783
|
}
|
|
6723
|
-
async function
|
|
6784
|
+
async function Lu(e, t) {
|
|
6724
6785
|
try {
|
|
6725
6786
|
return await e.connector.execute(t, e.signal);
|
|
6726
6787
|
} catch (e) {
|
|
6727
6788
|
throw e instanceof r ? e : new a("Google Drive proxy request failed.", { cause: e });
|
|
6728
6789
|
}
|
|
6729
6790
|
}
|
|
6730
|
-
function
|
|
6731
|
-
let n =
|
|
6791
|
+
function Ru(e, t) {
|
|
6792
|
+
let n = zu(e.data);
|
|
6732
6793
|
throw e.status == 401 || e.status == 403 && !n.toLowerCase().includes("ratelimit") ? new r(`Google Drive ${t} requires Connection reauthorization.`) : e.status == 408 || e.status == 429 || e.status >= 500 ? new a(`Google Drive ${t} is temporarily unavailable.`) : new i(`Google Drive ${t} rejected the subscription${n == "" ? "." : ` with ${n}.`}`);
|
|
6733
6794
|
}
|
|
6734
|
-
function
|
|
6735
|
-
if (!
|
|
6795
|
+
function zu(e) {
|
|
6796
|
+
if (!Q(e) || !Q(e.error)) return "";
|
|
6736
6797
|
let t = e.error.errors;
|
|
6737
|
-
return Array.isArray(t) &&
|
|
6798
|
+
return Array.isArray(t) && Q(t[0]) && typeof t[0].reason == "string" ? t[0].reason : typeof e.error.status == "string" ? e.error.status : "";
|
|
6738
6799
|
}
|
|
6739
|
-
function
|
|
6740
|
-
let n =
|
|
6800
|
+
function Bu(e, t) {
|
|
6801
|
+
let n = Z(e.driveId), r = Z(e.fileId), i = Z(e.time), a = Z(e.changeType), o = e.removed === !0;
|
|
6741
6802
|
return {
|
|
6742
6803
|
changeId: [
|
|
6743
6804
|
n ?? "my-drive",
|
|
@@ -6748,53 +6809,53 @@ function Iu(e, t) {
|
|
|
6748
6809
|
].join(":"),
|
|
6749
6810
|
changeType: a ?? null,
|
|
6750
6811
|
driveId: n ?? null,
|
|
6751
|
-
file:
|
|
6812
|
+
file: Q(e.file) ? e.file : null,
|
|
6752
6813
|
fileId: r ?? null,
|
|
6753
6814
|
notification: t,
|
|
6754
6815
|
removed: o,
|
|
6755
6816
|
time: i ?? null
|
|
6756
6817
|
};
|
|
6757
6818
|
}
|
|
6758
|
-
async function
|
|
6819
|
+
async function X(e, t, n) {
|
|
6759
6820
|
await e.saveSubscription({ channels: t }, n);
|
|
6760
6821
|
}
|
|
6761
|
-
function
|
|
6762
|
-
let n = e.map((e) => e.state == "active" ? Date.parse(e.expiration) -
|
|
6822
|
+
function Vu(e, t) {
|
|
6823
|
+
let n = e.map((e) => e.state == "active" ? Date.parse(e.expiration) - _u : e.state == "creating" ? Date.parse(e.createdAt) + vu : e.resourceId == null ? Date.parse(e.expiration) : t.getTime() + yu), r = n.length == 0 ? t.getTime() + yu : Math.min(...n);
|
|
6763
6824
|
return new Date(Math.max(t.getTime(), r));
|
|
6764
6825
|
}
|
|
6765
|
-
async function
|
|
6766
|
-
let n = await crypto.subtle.importKey("raw",
|
|
6826
|
+
async function Hu(e, t) {
|
|
6827
|
+
let n = await crypto.subtle.importKey("raw", Su.encode(e), {
|
|
6767
6828
|
hash: "SHA-256",
|
|
6768
6829
|
name: "HMAC"
|
|
6769
|
-
}, !1, ["sign"]), r = new Uint8Array(await crypto.subtle.sign("HMAC", n,
|
|
6830
|
+
}, !1, ["sign"]), r = new Uint8Array(await crypto.subtle.sign("HMAC", n, Su.encode(`google-drive-channel/v1/${t}`)));
|
|
6770
6831
|
return btoa(String.fromCharCode(...r)).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
|
|
6771
6832
|
}
|
|
6772
|
-
function
|
|
6833
|
+
function Uu(e, t) {
|
|
6773
6834
|
if (e.length != t.length) return !1;
|
|
6774
6835
|
let n = 0;
|
|
6775
6836
|
for (let r = 0; r < t.length; r += 1) n |= e.charCodeAt(r) ^ t.charCodeAt(r);
|
|
6776
6837
|
return n == 0;
|
|
6777
6838
|
}
|
|
6778
|
-
function
|
|
6839
|
+
function Wu(e) {
|
|
6779
6840
|
let t = typeof e == "string" || typeof e == "number" ? Number(e) : NaN;
|
|
6780
6841
|
return Number.isFinite(t) && t > 0 ? new Date(t).toISOString() : void 0;
|
|
6781
6842
|
}
|
|
6782
|
-
function
|
|
6843
|
+
function Z(e) {
|
|
6783
6844
|
return typeof e == "string" && e.length > 0 ? e : void 0;
|
|
6784
6845
|
}
|
|
6785
|
-
function
|
|
6846
|
+
function Q(e) {
|
|
6786
6847
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
6787
6848
|
}
|
|
6788
|
-
async function
|
|
6789
|
-
let t =
|
|
6849
|
+
async function Gu(e) {
|
|
6850
|
+
let t = Eu(e.state), n = e.header("x-goog-channel-id"), r = e.header("x-goog-resource-id"), i = e.header("x-goog-resource-state"), a = e.header("x-goog-channel-token");
|
|
6790
6851
|
if (n == null || r == null || i == null || a == null) return {
|
|
6791
6852
|
body: "",
|
|
6792
6853
|
contentType: "text/plain",
|
|
6793
6854
|
outcome: "respond",
|
|
6794
6855
|
status: 404
|
|
6795
6856
|
};
|
|
6796
|
-
let o =
|
|
6797
|
-
return s == null || !
|
|
6857
|
+
let o = ku(t), s = o.find((t) => t.id == n && Date.parse(t.expiration) > e.now.getTime());
|
|
6858
|
+
return s == null || !Uu(a, await Hu(e.callbackSecret, n)) || s.resourceId != null && s.resourceId != r ? {
|
|
6798
6859
|
body: "",
|
|
6799
6860
|
contentType: "text/plain",
|
|
6800
6861
|
outcome: "respond",
|
|
@@ -6802,19 +6863,19 @@ async function Vu(e) {
|
|
|
6802
6863
|
} : (s.resourceId ?? (o = o.map((e) => e.id == n ? {
|
|
6803
6864
|
...e,
|
|
6804
6865
|
resourceId: r
|
|
6805
|
-
} : e), await
|
|
6866
|
+
} : e), await X(t, o, e.now)), i != "sync" && i != "change" ? {
|
|
6806
6867
|
outcome: "ignored",
|
|
6807
6868
|
reason: "Google Drive notification state is not actionable."
|
|
6808
6869
|
} : { outcome: "wake" });
|
|
6809
6870
|
}
|
|
6810
|
-
var
|
|
6811
|
-
initialState:
|
|
6812
|
-
reconcile:
|
|
6813
|
-
receive:
|
|
6871
|
+
var Ku = {
|
|
6872
|
+
initialState: Tu.initialState,
|
|
6873
|
+
reconcile: Tu.reconcile,
|
|
6874
|
+
receive: Gu,
|
|
6814
6875
|
listener: {
|
|
6815
6876
|
intervalMs: 3e5,
|
|
6816
6877
|
async read(e) {
|
|
6817
|
-
let t = await
|
|
6878
|
+
let t = await Pu(e, e.checkpoint);
|
|
6818
6879
|
return {
|
|
6819
6880
|
checkpoint: t.checkpoint,
|
|
6820
6881
|
dedupeKey: t.dedupeKey,
|
|
@@ -6824,9 +6885,9 @@ var Hu = {
|
|
|
6824
6885
|
}
|
|
6825
6886
|
},
|
|
6826
6887
|
snapshot: {
|
|
6827
|
-
...
|
|
6888
|
+
...wu,
|
|
6828
6889
|
configSchema: {
|
|
6829
|
-
...
|
|
6890
|
+
...wu.configSchema,
|
|
6830
6891
|
description: "Configuration for googledrive.watch_changes."
|
|
6831
6892
|
},
|
|
6832
6893
|
key: "googledrive.watch_changes",
|
|
@@ -6843,12 +6904,12 @@ var Hu = {
|
|
|
6843
6904
|
required: ["events"]
|
|
6844
6905
|
}
|
|
6845
6906
|
}
|
|
6846
|
-
},
|
|
6907
|
+
}, qu = "application/vnd.google-apps.folder", Ju = "nextPageToken,incompleteSearch,files(id,name,mimeType,createdTime,modifiedTime,parents,trashed,webViewLink,driveId,size,version,lastModifyingUser(displayName,emailAddress))", Yu = /* @__PURE__ */ new Set([
|
|
6847
6908
|
"rateLimitExceeded",
|
|
6848
6909
|
"userRateLimitExceeded",
|
|
6849
6910
|
"dailyLimitExceeded",
|
|
6850
6911
|
"sharingRateLimitExceeded"
|
|
6851
|
-
]),
|
|
6912
|
+
]), Xu = /* @__PURE__ */ new Set(["insufficientFilePermissions", "appNotAuthorizedToFile"]), Zu = {
|
|
6852
6913
|
snapshot: {
|
|
6853
6914
|
configSchema: {
|
|
6854
6915
|
additionalProperties: !1,
|
|
@@ -6962,16 +7023,16 @@ var Hu = {
|
|
|
6962
7023
|
type: "poll"
|
|
6963
7024
|
},
|
|
6964
7025
|
async poll(e) {
|
|
6965
|
-
let t =
|
|
6966
|
-
if (e.checkpoint === null) return
|
|
6967
|
-
let n =
|
|
6968
|
-
return n.changeType === t.changeType ?
|
|
6969
|
-
checkpoint:
|
|
7026
|
+
let t = Qu(e.config);
|
|
7027
|
+
if (e.checkpoint === null) return ed(e, t);
|
|
7028
|
+
let n = $u(e.checkpoint);
|
|
7029
|
+
return n.changeType === t.changeType ? nd(e, t, n) : {
|
|
7030
|
+
checkpoint: td(e.now, t.changeType),
|
|
6970
7031
|
events: []
|
|
6971
7032
|
};
|
|
6972
7033
|
}
|
|
6973
7034
|
};
|
|
6974
|
-
function
|
|
7035
|
+
function Qu(e) {
|
|
6975
7036
|
return {
|
|
6976
7037
|
changeType: e.changeType,
|
|
6977
7038
|
driveId: e.driveId ?? "",
|
|
@@ -6982,8 +7043,8 @@ function Ju(e) {
|
|
|
6982
7043
|
namePrefix: e.namePrefix ?? ""
|
|
6983
7044
|
};
|
|
6984
7045
|
}
|
|
6985
|
-
function
|
|
6986
|
-
let n =
|
|
7046
|
+
function $u(t) {
|
|
7047
|
+
let n = $(t);
|
|
6987
7048
|
if (typeof n?.since != "string" || Number.isNaN(Date.parse(n.since))) throw new e("Google Drive checkpoint is invalid; recreate the Trigger.");
|
|
6988
7049
|
let r = n.boundaryKeys;
|
|
6989
7050
|
return {
|
|
@@ -6996,23 +7057,23 @@ function Yu(t) {
|
|
|
6996
7057
|
...Array.isArray(r) ? { boundaryKeys: r.filter((e) => typeof e == "string") } : {}
|
|
6997
7058
|
};
|
|
6998
7059
|
}
|
|
6999
|
-
async function
|
|
7000
|
-
let i = await
|
|
7060
|
+
async function ed(t, r) {
|
|
7061
|
+
let i = await ud(t, `/drive/v3/files/${encodeURIComponent(r.folderId)}`, {
|
|
7001
7062
|
fields: "id,name,mimeType,driveId,trashed",
|
|
7002
7063
|
supportsAllDrives: "true"
|
|
7003
7064
|
});
|
|
7004
|
-
|
|
7005
|
-
let a =
|
|
7065
|
+
dd(i, "folder probe");
|
|
7066
|
+
let a = $(i.data);
|
|
7006
7067
|
if (a == null) throw new n("Google Drive folder probe returned no payload.");
|
|
7007
|
-
if (a.mimeType !==
|
|
7068
|
+
if (a.mimeType !== qu) throw new e("Google Drive folderId does not point to a folder.");
|
|
7008
7069
|
if (a.trashed === !0) throw new e("The Google Drive folder is in the trash.");
|
|
7009
7070
|
if (r.driveId.length > 0 && (a.driveId ?? "") !== r.driveId) throw new e("The configured Google Drive shared drive does not contain this folder.");
|
|
7010
7071
|
return {
|
|
7011
|
-
checkpoint:
|
|
7072
|
+
checkpoint: td(t.now, r.changeType),
|
|
7012
7073
|
events: []
|
|
7013
7074
|
};
|
|
7014
7075
|
}
|
|
7015
|
-
function
|
|
7076
|
+
function td(e, t) {
|
|
7016
7077
|
let n = e.toISOString();
|
|
7017
7078
|
return {
|
|
7018
7079
|
changeType: t,
|
|
@@ -7020,11 +7081,11 @@ function Zu(e, t) {
|
|
|
7020
7081
|
since: n
|
|
7021
7082
|
};
|
|
7022
7083
|
}
|
|
7023
|
-
async function
|
|
7024
|
-
let r =
|
|
7084
|
+
async function nd(e, t, n) {
|
|
7085
|
+
let r = ad(t, n.since, n.floor), i = `${t.driveId}|${r}`, a = n.pageQuery == i ? n.pageToken : void 0, o = await ud(e, "/drive/v3/files", {
|
|
7025
7086
|
corpora: t.driveId.length == 0 ? "allDrives" : "drive",
|
|
7026
7087
|
driveId: t.driveId.length == 0 ? void 0 : t.driveId,
|
|
7027
|
-
fields:
|
|
7088
|
+
fields: Ju,
|
|
7028
7089
|
includeItemsFromAllDrives: "true",
|
|
7029
7090
|
pageSize: t.maxFilesPerPoll,
|
|
7030
7091
|
pageToken: a,
|
|
@@ -7032,74 +7093,74 @@ async function Qu(e, t, n) {
|
|
|
7032
7093
|
spaces: "drive",
|
|
7033
7094
|
supportsAllDrives: "true"
|
|
7034
7095
|
});
|
|
7035
|
-
|
|
7036
|
-
let s =
|
|
7096
|
+
dd(o, "files list");
|
|
7097
|
+
let s = $(o.data) ?? {}, c = new Set(n.boundaryKeys ?? []), l = [], u = [], d = a == null ? void 0 : n.maxSeen;
|
|
7037
7098
|
for (let e of s.files ?? []) {
|
|
7038
7099
|
if (e.id == null || e.id.length == 0) continue;
|
|
7039
|
-
let n =
|
|
7100
|
+
let n = cd(e, t.changeType);
|
|
7040
7101
|
if (n == null) continue;
|
|
7041
|
-
let r =
|
|
7042
|
-
u.push(r.dedupeKey),
|
|
7102
|
+
let r = ld(e, e.id, n, t.changeType);
|
|
7103
|
+
u.push(r.dedupeKey), hd(n, d) && (d = n), c.has(r.dedupeKey) || l.push(r);
|
|
7043
7104
|
}
|
|
7044
7105
|
if (s.incompleteSearch === !0) {
|
|
7045
|
-
let e = a == null ? {} :
|
|
7106
|
+
let e = a == null ? {} : rd(a, i, d);
|
|
7046
7107
|
return {
|
|
7047
|
-
checkpoint:
|
|
7108
|
+
checkpoint: id(n, t.changeType, n.since, u, e),
|
|
7048
7109
|
events: l
|
|
7049
7110
|
};
|
|
7050
7111
|
}
|
|
7051
7112
|
if (s.nextPageToken) return {
|
|
7052
|
-
checkpoint:
|
|
7113
|
+
checkpoint: id(n, t.changeType, n.since, u, rd(s.nextPageToken, i, d)),
|
|
7053
7114
|
events: l,
|
|
7054
7115
|
hasMore: !0
|
|
7055
7116
|
};
|
|
7056
7117
|
let f = d ?? n.since;
|
|
7057
7118
|
return {
|
|
7058
|
-
checkpoint:
|
|
7119
|
+
checkpoint: id(n, t.changeType, f, u),
|
|
7059
7120
|
events: l
|
|
7060
7121
|
};
|
|
7061
7122
|
}
|
|
7062
|
-
function
|
|
7123
|
+
function rd(e, t, n) {
|
|
7063
7124
|
return {
|
|
7064
7125
|
pageQuery: t,
|
|
7065
7126
|
pageToken: e,
|
|
7066
7127
|
...n == null ? {} : { maxSeen: n }
|
|
7067
7128
|
};
|
|
7068
7129
|
}
|
|
7069
|
-
function
|
|
7130
|
+
function id(e, t, n, r, i = {}) {
|
|
7070
7131
|
let a = [.../* @__PURE__ */ new Set([...e.boundaryKeys ?? [], ...r])].map((e) => ({
|
|
7071
7132
|
at: Date.parse(e.slice(e.indexOf(":") + 1)),
|
|
7072
7133
|
key: e
|
|
7073
|
-
})).filter(({ at: t }) => t >=
|
|
7134
|
+
})).filter(({ at: t }) => t >= od(n, e.floor)).toSorted((e, t) => t.at - e.at).slice(0, 200).map(({ key: e }) => e);
|
|
7074
7135
|
return {
|
|
7075
7136
|
changeType: t,
|
|
7076
7137
|
since: n,
|
|
7077
|
-
...
|
|
7138
|
+
...sd(e.floor, n),
|
|
7078
7139
|
...i,
|
|
7079
7140
|
...a.length == 0 ? {} : { boundaryKeys: a }
|
|
7080
7141
|
};
|
|
7081
7142
|
}
|
|
7082
|
-
function
|
|
7143
|
+
function ad(e, t, n) {
|
|
7083
7144
|
let r = e.changeType == "created" ? "createdTime" : "modifiedTime", i = [
|
|
7084
|
-
`'${
|
|
7145
|
+
`'${md(e.folderId)}' in parents`,
|
|
7085
7146
|
"trashed = false",
|
|
7086
|
-
`${r} >= '${new Date(
|
|
7147
|
+
`${r} >= '${new Date(od(t, n)).toISOString()}'`
|
|
7087
7148
|
];
|
|
7088
|
-
return e.itemTypes.has("folder") ? e.itemTypes.has("file") || i.push(`mimeType = '${
|
|
7149
|
+
return e.itemTypes.has("folder") ? e.itemTypes.has("file") || i.push(`mimeType = '${qu}'`) : i.push(`mimeType != '${qu}'`), e.mimeTypes.length > 0 && i.push(`(${e.mimeTypes.map((e) => `mimeType = '${md(e)}'`).join(" or ")})`), e.namePrefix.length > 0 && i.push(`name contains '${md(e.namePrefix)}'`), i.join(" and ");
|
|
7089
7150
|
}
|
|
7090
|
-
function
|
|
7151
|
+
function od(e, t) {
|
|
7091
7152
|
let n = Date.parse(e) - 6e4, r = t == null ? NaN : Date.parse(t);
|
|
7092
7153
|
return Number.isNaN(r) ? n : Math.max(n, r);
|
|
7093
7154
|
}
|
|
7094
|
-
function
|
|
7155
|
+
function sd(e, t) {
|
|
7095
7156
|
return e == null || Number.isNaN(Date.parse(e)) || Date.parse(t) - 6e4 >= Date.parse(e) ? {} : { floor: e };
|
|
7096
7157
|
}
|
|
7097
|
-
function
|
|
7158
|
+
function cd(e, t) {
|
|
7098
7159
|
let n = t == "created" ? e.createdTime : e.modifiedTime;
|
|
7099
7160
|
return n == null || n.length == 0 || Number.isNaN(Date.parse(n)) ? void 0 : n;
|
|
7100
7161
|
}
|
|
7101
|
-
function
|
|
7102
|
-
let i = e.mimeType ==
|
|
7162
|
+
function ld(e, t, n, r) {
|
|
7163
|
+
let i = e.mimeType == qu ? "folder" : "file", a = e.lastModifyingUser;
|
|
7103
7164
|
return {
|
|
7104
7165
|
dedupeKey: `${t}:${n}`,
|
|
7105
7166
|
payload: {
|
|
@@ -7121,7 +7182,7 @@ function ad(e, t, n, r) {
|
|
|
7121
7182
|
}
|
|
7122
7183
|
};
|
|
7123
7184
|
}
|
|
7124
|
-
async function
|
|
7185
|
+
async function ud(e, t, r) {
|
|
7125
7186
|
try {
|
|
7126
7187
|
return await e.connector.execute({
|
|
7127
7188
|
endpoint: t,
|
|
@@ -7132,48 +7193,48 @@ async function od(e, t, r) {
|
|
|
7132
7193
|
throw new n(`Google Drive proxy request to ${t} failed.`, { cause: e });
|
|
7133
7194
|
}
|
|
7134
7195
|
}
|
|
7135
|
-
function
|
|
7196
|
+
function dd(r, i) {
|
|
7136
7197
|
if (!(r.status >= 200 && r.status < 300)) {
|
|
7137
7198
|
if (r.status == 400 || r.status == 404) throw new e(`Google Drive ${i} rejected the configuration.`);
|
|
7138
7199
|
if (r.status == 401) throw new t(`Google Drive ${i} rejected the Connection.`);
|
|
7139
7200
|
if (r.status == 403) {
|
|
7140
|
-
let a =
|
|
7141
|
-
if (a.some((e) =>
|
|
7142
|
-
if (a.some((e) =>
|
|
7143
|
-
if (
|
|
7201
|
+
let a = fd(r.data);
|
|
7202
|
+
if (a.some((e) => Yu.has(e))) throw new n(`Google Drive ${i} was rate limited.`);
|
|
7203
|
+
if (a.some((e) => Xu.has(e))) throw new e(`Google Drive ${i} was rejected by an ACL.`);
|
|
7204
|
+
if (pd(r.data)) throw new t(`Google Drive ${i} needs additional scopes.`);
|
|
7144
7205
|
}
|
|
7145
7206
|
throw new n(`Google Drive ${i} failed with status ${r.status}.`);
|
|
7146
7207
|
}
|
|
7147
7208
|
}
|
|
7148
|
-
function
|
|
7149
|
-
let t =
|
|
7150
|
-
return [...[t?.errors, t?.details].flatMap((e) => Array.isArray(e) ? e : []).map((e) =>
|
|
7209
|
+
function fd(e) {
|
|
7210
|
+
let t = $($(e)?.error);
|
|
7211
|
+
return [...[t?.errors, t?.details].flatMap((e) => Array.isArray(e) ? e : []).map((e) => $(e)?.reason), t?.status].filter((e) => typeof e == "string");
|
|
7151
7212
|
}
|
|
7152
|
-
function
|
|
7153
|
-
if (
|
|
7154
|
-
let t =
|
|
7213
|
+
function pd(e) {
|
|
7214
|
+
if (fd(e).includes("ACCESS_TOKEN_SCOPE_INSUFFICIENT")) return !0;
|
|
7215
|
+
let t = $($(e)?.error)?.message;
|
|
7155
7216
|
return typeof t == "string" && t.toLowerCase().includes("insufficient authentication scopes");
|
|
7156
7217
|
}
|
|
7157
|
-
function
|
|
7218
|
+
function md(e) {
|
|
7158
7219
|
return e.replaceAll("\\", "\\\\").replaceAll("'", "\\'");
|
|
7159
7220
|
}
|
|
7160
|
-
function
|
|
7221
|
+
function hd(e, t) {
|
|
7161
7222
|
let n = Date.parse(e);
|
|
7162
7223
|
return Number.isNaN(n) ? !1 : t == null || Number.isNaN(Date.parse(t)) || n > Date.parse(t);
|
|
7163
7224
|
}
|
|
7164
|
-
function
|
|
7225
|
+
function $(e) {
|
|
7165
7226
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
7166
7227
|
}
|
|
7167
7228
|
//#endregion
|
|
7168
7229
|
//#region src/trigger/providers/google-sheets/on-row-added.ts
|
|
7169
|
-
var
|
|
7230
|
+
var gd = [
|
|
7170
7231
|
"permission_denied",
|
|
7171
7232
|
"accessnotconfigured",
|
|
7172
7233
|
"insufficientfilepermissions",
|
|
7173
7234
|
"appnotauthorizedtofile",
|
|
7174
7235
|
"the caller does not have permission",
|
|
7175
7236
|
"has not been used in project"
|
|
7176
|
-
],
|
|
7237
|
+
], _d = ["ratelimitexceeded", "dailylimitexceeded"], vd = {
|
|
7177
7238
|
snapshot: {
|
|
7178
7239
|
configSchema: {
|
|
7179
7240
|
additionalProperties: !1,
|
|
@@ -7267,19 +7328,19 @@ var fd = [
|
|
|
7267
7328
|
type: "poll"
|
|
7268
7329
|
},
|
|
7269
7330
|
async poll(e) {
|
|
7270
|
-
let t =
|
|
7331
|
+
let t = yd(e.config);
|
|
7271
7332
|
if (e.checkpoint === null) return {
|
|
7272
|
-
checkpoint: await
|
|
7333
|
+
checkpoint: await Sd(e, t, await xd(e, t)),
|
|
7273
7334
|
events: []
|
|
7274
7335
|
};
|
|
7275
|
-
let n =
|
|
7336
|
+
let n = bd(e.checkpoint), r = await xd(e, t);
|
|
7276
7337
|
if (n.spreadsheetId !== t.spreadsheetId || n.sheetId !== r.sheetId || n.lastRowNumber > r.rowCount) return {
|
|
7277
|
-
checkpoint: await
|
|
7338
|
+
checkpoint: await Sd(e, t, r),
|
|
7278
7339
|
events: []
|
|
7279
7340
|
};
|
|
7280
|
-
let i = await
|
|
7341
|
+
let i = await wd(e, t, r), a = Math.min(Math.max(t.firstDataRow, n.lastRowNumber), r.rowCount), o = Math.min(a + t.maxRowsPerPoll, r.rowCount), s = await Td(e, t, r, a, o, "row window fetch");
|
|
7281
7342
|
if (s.length == 0 && n.lastRowNumber >= t.firstDataRow) return {
|
|
7282
|
-
checkpoint: await
|
|
7343
|
+
checkpoint: await Sd(e, t, r),
|
|
7283
7344
|
events: []
|
|
7284
7345
|
};
|
|
7285
7346
|
let c = a + s.length - 1;
|
|
@@ -7291,11 +7352,11 @@ var fd = [
|
|
|
7291
7352
|
for (let [e, o] of s.entries()) {
|
|
7292
7353
|
let s = a + e;
|
|
7293
7354
|
if (!(s <= n.lastRowNumber)) {
|
|
7294
|
-
if (s == t.headerRow ||
|
|
7355
|
+
if (s == t.headerRow || Dd(o)) {
|
|
7295
7356
|
u += 1;
|
|
7296
7357
|
continue;
|
|
7297
7358
|
}
|
|
7298
|
-
l.push(await
|
|
7359
|
+
l.push(await Od(t, r, s, o, i));
|
|
7299
7360
|
}
|
|
7300
7361
|
}
|
|
7301
7362
|
let d = c == o && o < r.rowCount;
|
|
@@ -7311,7 +7372,7 @@ var fd = [
|
|
|
7311
7372
|
};
|
|
7312
7373
|
}
|
|
7313
7374
|
};
|
|
7314
|
-
function
|
|
7375
|
+
function yd(e) {
|
|
7315
7376
|
let t = (e.columnRange ?? "A:ZZZ").trim(), n = t.indexOf(":"), r = n < 0 ? t : t.slice(0, n), i = n < 0 ? t : t.slice(n + 1), a = e.spreadsheetId.trim();
|
|
7316
7377
|
return {
|
|
7317
7378
|
colEnd: i,
|
|
@@ -7325,8 +7386,8 @@ function hd(e) {
|
|
|
7325
7386
|
valueRender: e.valueRender ?? "UNFORMATTED_VALUE"
|
|
7326
7387
|
};
|
|
7327
7388
|
}
|
|
7328
|
-
function
|
|
7329
|
-
let n =
|
|
7389
|
+
function bd(t) {
|
|
7390
|
+
let n = Pd(t);
|
|
7330
7391
|
if (typeof n?.spreadsheetId != "string" || !Number.isInteger(n.sheetId) || !Number.isInteger(n.lastRowNumber)) throw new e("Google Sheets checkpoint is invalid; recreate the Trigger.");
|
|
7331
7392
|
return {
|
|
7332
7393
|
lastRowNumber: n.lastRowNumber,
|
|
@@ -7334,11 +7395,11 @@ function gd(t) {
|
|
|
7334
7395
|
spreadsheetId: n.spreadsheetId
|
|
7335
7396
|
};
|
|
7336
7397
|
}
|
|
7337
|
-
async function
|
|
7338
|
-
let i = await
|
|
7398
|
+
async function xd(t, r) {
|
|
7399
|
+
let i = await Ad(t, `/spreadsheets/${encodeURIComponent(r.spreadsheetId)}`, { fields: "sheets.properties(sheetId,title,sheetType,gridProperties)" });
|
|
7339
7400
|
if (i.status == 404) throw new e("The Google Sheets spreadsheet was not found.");
|
|
7340
|
-
|
|
7341
|
-
let a =
|
|
7401
|
+
jd(i, "spreadsheet metadata fetch");
|
|
7402
|
+
let a = Pd(i.data)?.sheets, o = (Array.isArray(a) ? a.map((e) => Pd(Pd(e)?.properties)) : []).filter((e) => e != null), s = (/^\d+$/.test(r.sheet) ? o.find(({ sheetId: e }) => e === Number(r.sheet)) : void 0) ?? o.find(({ title: e }) => e === r.sheet);
|
|
7342
7403
|
if (s == null) throw new e(`Google Sheets tab "${r.sheet}" does not exist.`);
|
|
7343
7404
|
if (s.sheetType != null && s.sheetType !== "GRID") throw new e("The Google Sheets tab is not a grid sheet.");
|
|
7344
7405
|
let c = s.gridProperties?.rowCount;
|
|
@@ -7349,45 +7410,45 @@ async function _d(t, r) {
|
|
|
7349
7410
|
title: s.title
|
|
7350
7411
|
};
|
|
7351
7412
|
}
|
|
7352
|
-
async function
|
|
7413
|
+
async function Sd(e, t, n) {
|
|
7353
7414
|
return {
|
|
7354
|
-
lastRowNumber: await
|
|
7415
|
+
lastRowNumber: await Cd(e, t, n),
|
|
7355
7416
|
sheetId: n.sheetId,
|
|
7356
7417
|
spreadsheetId: t.spreadsheetId
|
|
7357
7418
|
};
|
|
7358
7419
|
}
|
|
7359
|
-
async function
|
|
7420
|
+
async function Cd(e, t, n) {
|
|
7360
7421
|
if (n.rowCount < t.firstDataRow) return t.firstDataRow - 1;
|
|
7361
|
-
let r = await
|
|
7422
|
+
let r = await Td(e, t, n, t.firstDataRow, n.rowCount, "full-range scan");
|
|
7362
7423
|
return r.length == 0 ? t.firstDataRow - 1 : t.firstDataRow + r.length - 1;
|
|
7363
7424
|
}
|
|
7364
|
-
async function
|
|
7365
|
-
let r = await
|
|
7425
|
+
async function wd(e, t, n) {
|
|
7426
|
+
let r = await Ad(e, kd(t, n, t.headerRow, t.headerRow), {
|
|
7366
7427
|
majorDimension: "ROWS",
|
|
7367
7428
|
valueRenderOption: "FORMATTED_VALUE"
|
|
7368
7429
|
});
|
|
7369
|
-
return
|
|
7430
|
+
return jd(r, "header row fetch"), Ed(r.data)[0] ?? [];
|
|
7370
7431
|
}
|
|
7371
|
-
async function
|
|
7372
|
-
let o = await
|
|
7432
|
+
async function Td(e, t, n, r, i, a) {
|
|
7433
|
+
let o = await Ad(e, kd(t, n, r, i), {
|
|
7373
7434
|
dateTimeRenderOption: t.dateTimeRender,
|
|
7374
7435
|
majorDimension: "ROWS",
|
|
7375
7436
|
valueRenderOption: t.valueRender
|
|
7376
7437
|
});
|
|
7377
|
-
return
|
|
7438
|
+
return jd(o, a), Ed(o.data);
|
|
7378
7439
|
}
|
|
7379
|
-
function
|
|
7380
|
-
let t =
|
|
7440
|
+
function Ed(e) {
|
|
7441
|
+
let t = Pd(e)?.values;
|
|
7381
7442
|
return Array.isArray(t) ? t : [];
|
|
7382
7443
|
}
|
|
7383
|
-
function
|
|
7444
|
+
function Dd(e) {
|
|
7384
7445
|
return e.every((e) => e === "" || e == null);
|
|
7385
7446
|
}
|
|
7386
|
-
async function
|
|
7387
|
-
let a = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(r))), o = [...new Uint8Array(a)].slice(0, 8).map((e) => e.toString(16).padStart(2, "0")).join(""), s = {}, c =
|
|
7447
|
+
async function Od(e, t, n, r, i) {
|
|
7448
|
+
let a = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(r))), o = [...new Uint8Array(a)].slice(0, 8).map((e) => e.toString(16).padStart(2, "0")).join(""), s = {}, c = Md(e.colStart);
|
|
7388
7449
|
for (let [e, t] of r.entries()) {
|
|
7389
7450
|
let n = i[e];
|
|
7390
|
-
s[typeof n == "string" && n.length > 0 ? n :
|
|
7451
|
+
s[typeof n == "string" && n.length > 0 ? n : Nd(c + e)] = t;
|
|
7391
7452
|
}
|
|
7392
7453
|
return {
|
|
7393
7454
|
dedupeKey: `${t.sheetId}:${n}:${o}`,
|
|
@@ -7401,11 +7462,11 @@ async function wd(e, t, n, r, i) {
|
|
|
7401
7462
|
}
|
|
7402
7463
|
};
|
|
7403
7464
|
}
|
|
7404
|
-
function
|
|
7465
|
+
function kd(e, t, n, r) {
|
|
7405
7466
|
let i = encodeURIComponent(`'${t.title.replaceAll("'", "''")}'`);
|
|
7406
7467
|
return `/spreadsheets/${encodeURIComponent(e.spreadsheetId)}/values/${i}!${e.colStart}${n}:${e.colEnd}${r}`;
|
|
7407
7468
|
}
|
|
7408
|
-
async function
|
|
7469
|
+
async function Ad(e, t, r) {
|
|
7409
7470
|
try {
|
|
7410
7471
|
return await e.connector.execute({
|
|
7411
7472
|
endpoint: t,
|
|
@@ -7416,30 +7477,30 @@ async function Ed(e, t, r) {
|
|
|
7416
7477
|
throw new n(`Google Sheets proxy request to ${t} failed.`, { cause: e });
|
|
7417
7478
|
}
|
|
7418
7479
|
}
|
|
7419
|
-
function
|
|
7480
|
+
function jd(r, i) {
|
|
7420
7481
|
if (r.status >= 200 && r.status < 300) return;
|
|
7421
7482
|
if (r.status == 401) throw new t(`Google Sheets ${i} rejected the Connection.`);
|
|
7422
7483
|
let a = JSON.stringify(r.data ?? null).toLowerCase();
|
|
7423
7484
|
if (r.status == 403) {
|
|
7424
|
-
if (
|
|
7425
|
-
if (
|
|
7485
|
+
if (_d.some((e) => a.includes(e))) throw new n(`Google Sheets ${i} was rate limited.`);
|
|
7486
|
+
if (gd.some((e) => a.includes(e))) throw new t(`Google Sheets ${i} rejected the Connection.`);
|
|
7426
7487
|
}
|
|
7427
7488
|
throw r.status == 400 && a.includes("unable to parse range") ? new e("Google Sheets rejected the configured range.") : r.status == 413 ? new e("Google Sheets response is too large; narrow columnRange.") : new n(`Google Sheets ${i} failed with status ${r.status}.`);
|
|
7428
7489
|
}
|
|
7429
|
-
function
|
|
7490
|
+
function Md(e) {
|
|
7430
7491
|
let t = 0;
|
|
7431
7492
|
for (let n of e.toUpperCase()) t = t * 26 + n.charCodeAt(0) - 64;
|
|
7432
7493
|
return t;
|
|
7433
7494
|
}
|
|
7434
|
-
function
|
|
7495
|
+
function Nd(e) {
|
|
7435
7496
|
let t = "";
|
|
7436
7497
|
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
7437
7498
|
return t;
|
|
7438
7499
|
}
|
|
7439
|
-
function
|
|
7500
|
+
function Pd(e) {
|
|
7440
7501
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
7441
7502
|
}
|
|
7442
|
-
var
|
|
7503
|
+
var Fd = {
|
|
7443
7504
|
snapshot: {
|
|
7444
7505
|
configSchema: {
|
|
7445
7506
|
additionalProperties: !1,
|
|
@@ -7528,13 +7589,13 @@ var jd = {
|
|
|
7528
7589
|
type: "poll"
|
|
7529
7590
|
},
|
|
7530
7591
|
async poll(e) {
|
|
7531
|
-
let t =
|
|
7532
|
-
if (e.checkpoint === null) return
|
|
7533
|
-
let n =
|
|
7534
|
-
return n.target ===
|
|
7592
|
+
let t = Id(e.config);
|
|
7593
|
+
if (e.checkpoint === null) return Ld(e, t);
|
|
7594
|
+
let n = zd(e.checkpoint);
|
|
7595
|
+
return n.target === Zd(t) ? Hd(e, t, Vd(n, Bd(t.events))) : Ld(e, t);
|
|
7535
7596
|
}
|
|
7536
7597
|
};
|
|
7537
|
-
function
|
|
7598
|
+
function Id(e) {
|
|
7538
7599
|
return {
|
|
7539
7600
|
dataSourceId: e.dataSourceId ?? "",
|
|
7540
7601
|
databaseId: e.databaseId,
|
|
@@ -7543,9 +7604,9 @@ function Md(e) {
|
|
|
7543
7604
|
maxItemsPerPoll: e.maxItemsPerPoll ?? 25
|
|
7544
7605
|
};
|
|
7545
7606
|
}
|
|
7546
|
-
async function
|
|
7547
|
-
let n = await
|
|
7548
|
-
return
|
|
7607
|
+
async function Ld(e, t) {
|
|
7608
|
+
let n = await Rd(e, t), r = Bd(t.events);
|
|
7609
|
+
return Xd(await Yd(e, {
|
|
7549
7610
|
body: {
|
|
7550
7611
|
page_size: 1,
|
|
7551
7612
|
sorts: [{
|
|
@@ -7560,31 +7621,31 @@ async function Nd(e, t) {
|
|
|
7560
7621
|
cursorField: r,
|
|
7561
7622
|
dataSourceId: n,
|
|
7562
7623
|
since: (/* @__PURE__ */ new Date(Math.ceil(e.now.getTime() / 6e4) * 6e4)).toISOString(),
|
|
7563
|
-
target:
|
|
7624
|
+
target: Zd(t)
|
|
7564
7625
|
},
|
|
7565
7626
|
events: []
|
|
7566
7627
|
};
|
|
7567
7628
|
}
|
|
7568
|
-
async function
|
|
7569
|
-
let r = await
|
|
7629
|
+
async function Rd(t, n) {
|
|
7630
|
+
let r = await Yd(t, {
|
|
7570
7631
|
endpoint: `/databases/${encodeURIComponent(n.databaseId)}`,
|
|
7571
7632
|
method: "GET"
|
|
7572
7633
|
});
|
|
7573
|
-
|
|
7574
|
-
let i =
|
|
7575
|
-
let t =
|
|
7634
|
+
Xd(r, "database resolve");
|
|
7635
|
+
let i = rf(r.data)?.data_sources, a = Array.isArray(i) ? i.flatMap((e) => {
|
|
7636
|
+
let t = rf(e)?.id;
|
|
7576
7637
|
return typeof t == "string" && t.length > 0 ? [t] : [];
|
|
7577
7638
|
}) : [];
|
|
7578
7639
|
if (n.dataSourceId.length > 0) {
|
|
7579
|
-
let t =
|
|
7640
|
+
let t = Qd(n.dataSourceId), r = a.find((e) => Qd(e) == t);
|
|
7580
7641
|
if (r == null) throw new e("The Notion data source does not belong to the configured database.");
|
|
7581
7642
|
return r;
|
|
7582
7643
|
}
|
|
7583
7644
|
if (a.length == 1) return a[0];
|
|
7584
7645
|
throw a.length == 0 ? new e("The Notion database has no data sources.") : new e("The Notion database has multiple data sources; configure dataSourceId.");
|
|
7585
7646
|
}
|
|
7586
|
-
function
|
|
7587
|
-
let n =
|
|
7647
|
+
function zd(t) {
|
|
7648
|
+
let n = rf(t), r = n?.cursorField;
|
|
7588
7649
|
if (typeof n?.dataSourceId != "string" || n.dataSourceId.length == 0 || r !== "created_time" && r !== "last_edited_time" || typeof n.since != "string" || n.since.length == 0) throw new e("Notion checkpoint is invalid; recreate the Trigger.");
|
|
7589
7650
|
return {
|
|
7590
7651
|
cursorField: r,
|
|
@@ -7596,10 +7657,10 @@ function Fd(t) {
|
|
|
7596
7657
|
...n.sinceOnly === !0 ? { sinceOnly: !0 } : {}
|
|
7597
7658
|
};
|
|
7598
7659
|
}
|
|
7599
|
-
function
|
|
7660
|
+
function Bd(e) {
|
|
7600
7661
|
return e.length == 1 && e[0] == "page_added" ? "created_time" : "last_edited_time";
|
|
7601
7662
|
}
|
|
7602
|
-
function
|
|
7663
|
+
function Vd(e, t) {
|
|
7603
7664
|
return e.cursorField == t ? e : {
|
|
7604
7665
|
cursorField: t,
|
|
7605
7666
|
dataSourceId: e.dataSourceId,
|
|
@@ -7607,11 +7668,11 @@ function Ld(e, t) {
|
|
|
7607
7668
|
target: e.target
|
|
7608
7669
|
};
|
|
7609
7670
|
}
|
|
7610
|
-
async function
|
|
7671
|
+
async function Hd(e, t, n) {
|
|
7611
7672
|
let r = [], i = 0, a = 0, o = null, s = n.startCursor, c = null;
|
|
7612
7673
|
for (let l = 0; l < 5; l += 1) {
|
|
7613
|
-
let l = await
|
|
7614
|
-
body:
|
|
7674
|
+
let l = await Yd(e, {
|
|
7675
|
+
body: Gd(n, t.maxItemsPerPoll - a, s),
|
|
7615
7676
|
endpoint: `/data_sources/${encodeURIComponent(n.dataSourceId)}/query`,
|
|
7616
7677
|
method: "POST"
|
|
7617
7678
|
});
|
|
@@ -7619,14 +7680,14 @@ async function Rd(e, t, n) {
|
|
|
7619
7680
|
c = "restarted";
|
|
7620
7681
|
break;
|
|
7621
7682
|
}
|
|
7622
|
-
|
|
7623
|
-
let u =
|
|
7683
|
+
Xd(l, "data source query");
|
|
7684
|
+
let u = rf(l.data) ?? {};
|
|
7624
7685
|
for (let e of u.results ?? []) {
|
|
7625
7686
|
a += 1;
|
|
7626
7687
|
let s = n.cursorField == "created_time" ? e.created_time : e.last_edited_time;
|
|
7627
|
-
s != null && s.length > 0 && (o =
|
|
7628
|
-
let c =
|
|
7629
|
-
t.events.includes(c) ? r.push(
|
|
7688
|
+
s != null && s.length > 0 && (o = ef(o, s));
|
|
7689
|
+
let c = Kd(e);
|
|
7690
|
+
t.events.includes(c) ? r.push(qd(e, c, t, n)) : i += 1;
|
|
7630
7691
|
}
|
|
7631
7692
|
if (u.request_status?.type == "incomplete") {
|
|
7632
7693
|
c = "truncated";
|
|
@@ -7652,36 +7713,36 @@ async function Rd(e, t, n) {
|
|
|
7652
7713
|
...l,
|
|
7653
7714
|
since: n.since,
|
|
7654
7715
|
startCursor: c.nextCursor,
|
|
7655
|
-
...
|
|
7716
|
+
...Wd(n)
|
|
7656
7717
|
} : {
|
|
7657
7718
|
...l,
|
|
7658
|
-
...
|
|
7719
|
+
...Ud(n, c, o, e.now)
|
|
7659
7720
|
},
|
|
7660
7721
|
events: r,
|
|
7661
7722
|
filtered: i,
|
|
7662
7723
|
...c == "complete" ? {} : { hasMore: !0 }
|
|
7663
7724
|
};
|
|
7664
7725
|
}
|
|
7665
|
-
function
|
|
7726
|
+
function Ud(e, t, n, r) {
|
|
7666
7727
|
let i = {
|
|
7667
7728
|
since: e.since,
|
|
7668
|
-
...
|
|
7729
|
+
...Wd(e)
|
|
7669
7730
|
}, a = Date.parse(e.since) + 6e4 <= r.getTime() ? {
|
|
7670
7731
|
since: e.since,
|
|
7671
7732
|
sinceExclusive: !0
|
|
7672
7733
|
} : i;
|
|
7673
|
-
return n != null &&
|
|
7734
|
+
return n != null && tf(n, e.since) ? { since: n } : t == "restarted" ? i : t == "complete" ? e.sinceOnly === !0 || n != null ? a : i : n == null ? i : e.sinceOnly === !0 ? a : {
|
|
7674
7735
|
since: e.since,
|
|
7675
7736
|
sinceOnly: !0
|
|
7676
7737
|
};
|
|
7677
7738
|
}
|
|
7678
|
-
function
|
|
7739
|
+
function Wd(e) {
|
|
7679
7740
|
return {
|
|
7680
7741
|
...e.sinceExclusive === !0 ? { sinceExclusive: !0 } : {},
|
|
7681
7742
|
...e.sinceOnly === !0 ? { sinceOnly: !0 } : {}
|
|
7682
7743
|
};
|
|
7683
7744
|
}
|
|
7684
|
-
function
|
|
7745
|
+
function Gd(e, t, n) {
|
|
7685
7746
|
let r = e.cursorField;
|
|
7686
7747
|
return {
|
|
7687
7748
|
filter: e.sinceOnly === !0 ? { and: [{
|
|
@@ -7702,70 +7763,70 @@ function Vd(e, t, n) {
|
|
|
7702
7763
|
...n == null ? {} : { start_cursor: n }
|
|
7703
7764
|
};
|
|
7704
7765
|
}
|
|
7705
|
-
function
|
|
7706
|
-
return
|
|
7766
|
+
function Kd(e) {
|
|
7767
|
+
return nf(e.created_time) === nf(e.last_edited_time) ? "page_added" : "page_updated";
|
|
7707
7768
|
}
|
|
7708
|
-
function
|
|
7769
|
+
function qd(e, t, n, r) {
|
|
7709
7770
|
return {
|
|
7710
|
-
dedupeKey: t == "page_added" ? `added:${e.id}` : `updated:${e.id}:${
|
|
7771
|
+
dedupeKey: t == "page_added" ? `added:${e.id}` : `updated:${e.id}:${nf(e.last_edited_time) ?? e.last_edited_time ?? ""}`,
|
|
7711
7772
|
payload: {
|
|
7712
7773
|
createdBy: { id: e.created_by?.id ?? "" },
|
|
7713
7774
|
createdTime: e.created_time ?? "",
|
|
7714
7775
|
dataSourceId: r.dataSourceId,
|
|
7715
|
-
databaseId:
|
|
7776
|
+
databaseId: $d(n.databaseId),
|
|
7716
7777
|
event: t,
|
|
7717
7778
|
lastEditedBy: { id: e.last_edited_by?.id ?? "" },
|
|
7718
7779
|
lastEditedTime: e.last_edited_time ?? "",
|
|
7719
7780
|
pageId: e.id,
|
|
7720
7781
|
...n.includeProperties ? { properties: e.properties ?? {} } : {},
|
|
7721
|
-
title:
|
|
7782
|
+
title: Jd(e.properties ?? {}),
|
|
7722
7783
|
url: e.url ?? ""
|
|
7723
7784
|
}
|
|
7724
7785
|
};
|
|
7725
7786
|
}
|
|
7726
|
-
function
|
|
7787
|
+
function Jd(e) {
|
|
7727
7788
|
for (let t of Object.values(e)) {
|
|
7728
|
-
let e =
|
|
7729
|
-
if (!(e?.type !== "title" || !Array.isArray(e.title))) return e.title.map((e) => typeof
|
|
7789
|
+
let e = rf(t);
|
|
7790
|
+
if (!(e?.type !== "title" || !Array.isArray(e.title))) return e.title.map((e) => typeof rf(e)?.plain_text == "string" ? rf(e).plain_text : "").join("");
|
|
7730
7791
|
}
|
|
7731
7792
|
return "";
|
|
7732
7793
|
}
|
|
7733
|
-
async function
|
|
7794
|
+
async function Yd(e, t) {
|
|
7734
7795
|
try {
|
|
7735
7796
|
return await e.connector.execute(t, e.signal);
|
|
7736
7797
|
} catch (e) {
|
|
7737
7798
|
throw new n(`Notion proxy request to ${t.endpoint} failed.`, { cause: e });
|
|
7738
7799
|
}
|
|
7739
7800
|
}
|
|
7740
|
-
function
|
|
7801
|
+
function Xd(r, i) {
|
|
7741
7802
|
if (!(r.status >= 200 && r.status < 300)) throw r.status == 401 || r.status == 403 ? new t(`Notion ${i} rejected the Connection.`) : r.status == 404 ? new e("The Notion target was not found or is not shared with the Connection.") : r.status == 400 ? new e(`Notion ${i} rejected the configuration.`) : new n(`Notion ${i} failed with status ${r.status}.`);
|
|
7742
7803
|
}
|
|
7743
|
-
function
|
|
7804
|
+
function Zd(e) {
|
|
7744
7805
|
return `${e.databaseId}|${e.dataSourceId}`;
|
|
7745
7806
|
}
|
|
7746
|
-
function
|
|
7807
|
+
function Qd(e) {
|
|
7747
7808
|
return e.replaceAll("-", "").toLowerCase();
|
|
7748
7809
|
}
|
|
7749
|
-
function
|
|
7750
|
-
let t =
|
|
7810
|
+
function $d(e) {
|
|
7811
|
+
let t = Qd(e);
|
|
7751
7812
|
return `${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20)}`;
|
|
7752
7813
|
}
|
|
7753
|
-
function
|
|
7814
|
+
function ef(e, t) {
|
|
7754
7815
|
let n = Date.parse(t);
|
|
7755
7816
|
return Number.isNaN(n) || e != null && n < Date.parse(e) ? e : t;
|
|
7756
7817
|
}
|
|
7757
|
-
function
|
|
7818
|
+
function tf(e, t) {
|
|
7758
7819
|
return !Number.isNaN(Date.parse(e)) && !Number.isNaN(Date.parse(t)) && Date.parse(e) > Date.parse(t);
|
|
7759
7820
|
}
|
|
7760
|
-
function
|
|
7821
|
+
function nf(e) {
|
|
7761
7822
|
if (e == null || e.length == 0) return null;
|
|
7762
7823
|
let t = Date.parse(e);
|
|
7763
7824
|
return Number.isNaN(t) ? null : new Date(t).toISOString();
|
|
7764
7825
|
}
|
|
7765
|
-
function
|
|
7826
|
+
function rf(e) {
|
|
7766
7827
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
7767
7828
|
}
|
|
7768
|
-
var
|
|
7829
|
+
var af = {
|
|
7769
7830
|
snapshot: {
|
|
7770
7831
|
configSchema: {
|
|
7771
7832
|
additionalProperties: !1,
|
|
@@ -7872,14 +7933,14 @@ var $d = {
|
|
|
7872
7933
|
type: "poll"
|
|
7873
7934
|
},
|
|
7874
7935
|
async poll(e) {
|
|
7875
|
-
let t =
|
|
7936
|
+
let t = of(e.config);
|
|
7876
7937
|
if (e.checkpoint === null) return {
|
|
7877
|
-
checkpoint: await
|
|
7938
|
+
checkpoint: await sf(e, t),
|
|
7878
7939
|
events: []
|
|
7879
7940
|
};
|
|
7880
|
-
let n =
|
|
7941
|
+
let n = lf(e.checkpoint), { items: r, next: i } = await uf(e, n, t.maxItemsPerPoll), a = [], o = 0;
|
|
7881
7942
|
for (let [e, i] of r) {
|
|
7882
|
-
let r =
|
|
7943
|
+
let r = df(e, i, t, new Date(n.lastPolledAt));
|
|
7883
7944
|
r != "structural" && (r == "filtered" ? o += 1 : a.push(r));
|
|
7884
7945
|
}
|
|
7885
7946
|
return {
|
|
@@ -7890,7 +7951,7 @@ var $d = {
|
|
|
7890
7951
|
};
|
|
7891
7952
|
}
|
|
7892
7953
|
};
|
|
7893
|
-
function
|
|
7954
|
+
function of(e) {
|
|
7894
7955
|
return {
|
|
7895
7956
|
events: e.events ?? ["created", "updated"],
|
|
7896
7957
|
itemId: (e.itemId ?? "").trim(),
|
|
@@ -7899,25 +7960,25 @@ function ef(e) {
|
|
|
7899
7960
|
parentFolderId: (e.parentFolderId ?? "").trim()
|
|
7900
7961
|
};
|
|
7901
7962
|
}
|
|
7902
|
-
async function
|
|
7903
|
-
let i = await
|
|
7963
|
+
async function sf(t, r) {
|
|
7964
|
+
let i = await mf(t, "/me/drive/root/delta", { token: "latest" });
|
|
7904
7965
|
if (i.status == 404) throw new e("OneDrive is not provisioned for this account.");
|
|
7905
|
-
|
|
7906
|
-
let a =
|
|
7966
|
+
gf(i, "delta seeding");
|
|
7967
|
+
let a = xf(i.data)?.["@odata.deltaLink"], o = a == null ? null : yf(a);
|
|
7907
7968
|
if (o == null) throw new n("OneDrive delta seeding response has no delta token.");
|
|
7908
|
-
return await
|
|
7969
|
+
return await cf(t, "parentFolderId", r.parentFolderId), await cf(t, "itemId", r.itemId), {
|
|
7909
7970
|
deltaToken: o,
|
|
7910
7971
|
lastPolledAt: t.now.toISOString()
|
|
7911
7972
|
};
|
|
7912
7973
|
}
|
|
7913
|
-
async function
|
|
7974
|
+
async function cf(t, n, r) {
|
|
7914
7975
|
if (r.length == 0) return;
|
|
7915
|
-
let i = await
|
|
7976
|
+
let i = await mf(t, `/me/drive/items/${encodeURIComponent(r)}`, {});
|
|
7916
7977
|
if (i.status == 400 || i.status == 404) throw new e(`OneDrive ${n} does not identify an item in this drive.`);
|
|
7917
|
-
|
|
7978
|
+
gf(i, `${n} validation`);
|
|
7918
7979
|
}
|
|
7919
|
-
function
|
|
7920
|
-
let n =
|
|
7980
|
+
function lf(t) {
|
|
7981
|
+
let n = xf(t);
|
|
7921
7982
|
if (typeof n?.deltaToken != "string" || n.deltaToken.length == 0 || typeof n.lastPolledAt != "string" || Number.isNaN(Date.parse(n.lastPolledAt))) throw new e("OneDrive checkpoint is invalid; recreate the Trigger.");
|
|
7922
7983
|
return {
|
|
7923
7984
|
deltaToken: n.deltaToken,
|
|
@@ -7925,28 +7986,28 @@ function rf(t) {
|
|
|
7925
7986
|
...typeof n.pageToken == "string" && n.pageToken.length > 0 ? { pageToken: n.pageToken } : {}
|
|
7926
7987
|
};
|
|
7927
7988
|
}
|
|
7928
|
-
async function
|
|
7989
|
+
async function uf(e, t, r) {
|
|
7929
7990
|
let i = /* @__PURE__ */ new Map(), a = t.pageToken ?? t.deltaToken;
|
|
7930
7991
|
for (let t = 0; t < 5; t += 1) {
|
|
7931
|
-
let t = await
|
|
7992
|
+
let t = await mf(e, "/me/drive/root/delta", {
|
|
7932
7993
|
$top: r,
|
|
7933
7994
|
token: a
|
|
7934
7995
|
});
|
|
7935
|
-
|
|
7936
|
-
let o =
|
|
7996
|
+
hf(t);
|
|
7997
|
+
let o = xf(t.data) ?? {};
|
|
7937
7998
|
for (let e of o.value ?? []) e.id != null && e.id.length > 0 && i.set(e.id, e);
|
|
7938
7999
|
if (o["@odata.deltaLink"]) return {
|
|
7939
8000
|
items: i,
|
|
7940
8001
|
next: {
|
|
7941
8002
|
checkpoint: {
|
|
7942
|
-
deltaToken:
|
|
8003
|
+
deltaToken: vf(o["@odata.deltaLink"]),
|
|
7943
8004
|
lastPolledAt: e.now.toISOString()
|
|
7944
8005
|
},
|
|
7945
8006
|
hasMore: !1
|
|
7946
8007
|
}
|
|
7947
8008
|
};
|
|
7948
8009
|
if (!o["@odata.nextLink"]) throw new n("OneDrive delta response has no continuation link.");
|
|
7949
|
-
a =
|
|
8010
|
+
a = vf(o["@odata.nextLink"]);
|
|
7950
8011
|
}
|
|
7951
8012
|
return {
|
|
7952
8013
|
items: i,
|
|
@@ -7960,17 +8021,17 @@ async function af(e, t, r) {
|
|
|
7960
8021
|
}
|
|
7961
8022
|
};
|
|
7962
8023
|
}
|
|
7963
|
-
function
|
|
8024
|
+
function df(e, t, n, r) {
|
|
7964
8025
|
if (t.root != null) return "structural";
|
|
7965
|
-
let i =
|
|
8026
|
+
let i = ff(t);
|
|
7966
8027
|
if (i == null) return "structural";
|
|
7967
|
-
let a = t.deleted == null ?
|
|
7968
|
-
return !n.events.includes(a) || !n.itemTypes.includes(i) || n.parentFolderId.length > 0 && t.parentReference?.id !== n.parentFolderId || n.itemId.length > 0 && e !== n.itemId ? "filtered" :
|
|
8028
|
+
let a = t.deleted == null ? bf(t.createdDateTime, r) ? "created" : "updated" : "deleted";
|
|
8029
|
+
return !n.events.includes(a) || !n.itemTypes.includes(i) || n.parentFolderId.length > 0 && t.parentReference?.id !== n.parentFolderId || n.itemId.length > 0 && e !== n.itemId ? "filtered" : pf(e, t, a, i);
|
|
7969
8030
|
}
|
|
7970
|
-
function
|
|
8031
|
+
function ff(e) {
|
|
7971
8032
|
return e.file == null ? e.folder == null ? e.deleted == null ? null : "file" : "folder" : "file";
|
|
7972
8033
|
}
|
|
7973
|
-
function
|
|
8034
|
+
function pf(e, t, n, r) {
|
|
7974
8035
|
return {
|
|
7975
8036
|
dedupeKey: t.deleted == null ? `${e}:${t.eTag ?? t.lastModifiedDateTime}` : `${e}:deleted`,
|
|
7976
8037
|
payload: {
|
|
@@ -7989,7 +8050,7 @@ function cf(e, t, n, r) {
|
|
|
7989
8050
|
}
|
|
7990
8051
|
};
|
|
7991
8052
|
}
|
|
7992
|
-
async function
|
|
8053
|
+
async function mf(e, t, r) {
|
|
7993
8054
|
try {
|
|
7994
8055
|
return await e.connector.execute({
|
|
7995
8056
|
endpoint: t,
|
|
@@ -8000,31 +8061,31 @@ async function lf(e, t, r) {
|
|
|
8000
8061
|
throw new n(`OneDrive proxy request to ${t} failed.`, { cause: e });
|
|
8001
8062
|
}
|
|
8002
8063
|
}
|
|
8003
|
-
function
|
|
8004
|
-
if (t.status == 410 &&
|
|
8064
|
+
function hf(t) {
|
|
8065
|
+
if (t.status == 410 && _f(t.data)) throw new e("OneDrive delta token expired; recreate the Trigger.");
|
|
8005
8066
|
if (t.status == 404) throw new e("OneDrive is not provisioned for this account.");
|
|
8006
8067
|
if (t.status == 400) throw new e("OneDrive rejected the delta token; recreate the Trigger.");
|
|
8007
|
-
|
|
8068
|
+
gf(t, "delta list");
|
|
8008
8069
|
}
|
|
8009
|
-
function
|
|
8070
|
+
function gf(e, r) {
|
|
8010
8071
|
if (!(e.status >= 200 && e.status < 300)) throw e.status == 401 || e.status == 403 ? new t(`OneDrive ${r} rejected the Connection.`) : new n(`OneDrive ${r} failed with status ${e.status}.`);
|
|
8011
8072
|
}
|
|
8012
|
-
function
|
|
8013
|
-
let t =
|
|
8073
|
+
function _f(e) {
|
|
8074
|
+
let t = xf(e)?.error;
|
|
8014
8075
|
for (; t != null;) {
|
|
8015
|
-
let e =
|
|
8076
|
+
let e = xf(t);
|
|
8016
8077
|
if (e == null) break;
|
|
8017
8078
|
if (e.code == "resyncChangesApplyDifferences" || e.code == "resyncChangesUploadDifferences") return !0;
|
|
8018
8079
|
t = e.innerError ?? e.innererror;
|
|
8019
8080
|
}
|
|
8020
8081
|
return !1;
|
|
8021
8082
|
}
|
|
8022
|
-
function
|
|
8023
|
-
let t =
|
|
8083
|
+
function vf(e) {
|
|
8084
|
+
let t = yf(e);
|
|
8024
8085
|
if (t == null) throw new n("OneDrive delta link has no token.");
|
|
8025
8086
|
return t;
|
|
8026
8087
|
}
|
|
8027
|
-
function
|
|
8088
|
+
function yf(e) {
|
|
8028
8089
|
let t = /[?&]token=([^&#]+)/.exec(e)?.[1] ?? /\(token='([^']+)'\)/.exec(e)?.[1];
|
|
8029
8090
|
if (t == null) return null;
|
|
8030
8091
|
try {
|
|
@@ -8033,24 +8094,24 @@ function mf(e) {
|
|
|
8033
8094
|
return t;
|
|
8034
8095
|
}
|
|
8035
8096
|
}
|
|
8036
|
-
function
|
|
8097
|
+
function bf(e, t) {
|
|
8037
8098
|
if (e == null || e.length == 0) return !1;
|
|
8038
8099
|
let n = new Date(e);
|
|
8039
8100
|
return !Number.isNaN(n.getTime()) && n >= t;
|
|
8040
8101
|
}
|
|
8041
|
-
function
|
|
8102
|
+
function xf(e) {
|
|
8042
8103
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
8043
8104
|
}
|
|
8044
8105
|
//#endregion
|
|
8045
8106
|
//#region src/trigger/providers/outlook/on-message-received.ts
|
|
8046
|
-
var
|
|
8107
|
+
var Sf = "inbox", Cf = 25, wf = 100, Tf = "1970-01-01T00:00:00Z", Ef = "id,internetMessageId,conversationId,subject,bodyPreview,from,toRecipients,receivedDateTime,hasAttachments,isRead,isDraft,importance,categories,parentFolderId,webLink", Df = {
|
|
8047
8108
|
snapshot: {
|
|
8048
8109
|
configSchema: {
|
|
8049
8110
|
additionalProperties: !1,
|
|
8050
8111
|
description: "Configuration for outlook.on_message_received. Every configured matching field must match.",
|
|
8051
8112
|
properties: {
|
|
8052
8113
|
folder: {
|
|
8053
|
-
default:
|
|
8114
|
+
default: Sf,
|
|
8054
8115
|
description: "A well-known mail folder name, folder ID, or an empty string for the whole mailbox.",
|
|
8055
8116
|
pattern: "^[A-Za-z0-9_=-]*$",
|
|
8056
8117
|
type: "string"
|
|
@@ -8060,7 +8121,7 @@ var _f = "inbox", vf = 25, yf = 100, bf = "1970-01-01T00:00:00Z", xf = "id,inter
|
|
|
8060
8121
|
type: "boolean"
|
|
8061
8122
|
},
|
|
8062
8123
|
maxMessagesPerPoll: {
|
|
8063
|
-
default:
|
|
8124
|
+
default: Cf,
|
|
8064
8125
|
maximum: 100,
|
|
8065
8126
|
minimum: 1,
|
|
8066
8127
|
type: "integer"
|
|
@@ -8156,37 +8217,37 @@ var _f = "inbox", vf = 25, yf = 100, bf = "1970-01-01T00:00:00Z", xf = "id,inter
|
|
|
8156
8217
|
type: "poll"
|
|
8157
8218
|
},
|
|
8158
8219
|
async poll(t) {
|
|
8159
|
-
let n =
|
|
8220
|
+
let n = Of(t.config);
|
|
8160
8221
|
if (t.checkpoint === null) return {
|
|
8161
|
-
checkpoint: await
|
|
8222
|
+
checkpoint: await kf(t, n),
|
|
8162
8223
|
events: []
|
|
8163
8224
|
};
|
|
8164
|
-
let r =
|
|
8165
|
-
$filter:
|
|
8225
|
+
let r = Af(t.checkpoint), i = await Ff(t, jf(n.folder), {
|
|
8226
|
+
$filter: Mf(n, r.lastReceivedDateTime),
|
|
8166
8227
|
$orderby: "receivedDateTime asc",
|
|
8167
|
-
$select:
|
|
8228
|
+
$select: Ef,
|
|
8168
8229
|
$top: n.maxMessagesPerPoll
|
|
8169
8230
|
});
|
|
8170
|
-
|
|
8171
|
-
let a =
|
|
8231
|
+
If(i, "message list");
|
|
8232
|
+
let a = Rf(i.data);
|
|
8172
8233
|
if (a.length == 0) return {
|
|
8173
8234
|
checkpoint: r,
|
|
8174
8235
|
events: []
|
|
8175
8236
|
};
|
|
8176
8237
|
let o = Date.parse(r.lastReceivedDateTime), s = o, c = r.lastReceivedDateTime;
|
|
8177
8238
|
for (let e of a) {
|
|
8178
|
-
let t =
|
|
8239
|
+
let t = Bf(e.receivedDateTime);
|
|
8179
8240
|
e.receivedDateTime != null && t != null && t > s && (s = t, c = e.receivedDateTime);
|
|
8180
8241
|
}
|
|
8181
8242
|
let l = s > o, u = new Set(r.boundaryMessageIds), d = a.length >= n.maxMessagesPerPoll;
|
|
8182
8243
|
if (d && !l && a.every((e) => typeof e.id == "string" && u.has(e.id))) throw new e("Outlook cursor is stuck on a full timestamp boundary; increase maxMessagesPerPoll and resume the Trigger.");
|
|
8183
8244
|
let f = new Set(l ? [] : r.boundaryMessageIds), p = [], m = 0;
|
|
8184
|
-
for (let e of a) if (e.id != null && e.id.length != 0 && (
|
|
8185
|
-
if (!
|
|
8245
|
+
for (let e of a) if (e.id != null && e.id.length != 0 && (Bf(e.receivedDateTime) == s && f.add(e.id), !u.has(e.id))) {
|
|
8246
|
+
if (!Nf(e, n)) {
|
|
8186
8247
|
m += 1;
|
|
8187
8248
|
continue;
|
|
8188
8249
|
}
|
|
8189
|
-
p.push(
|
|
8250
|
+
p.push(Pf(e, e.id));
|
|
8190
8251
|
}
|
|
8191
8252
|
let ee = d && (l || p.length > 0);
|
|
8192
8253
|
return {
|
|
@@ -8200,34 +8261,34 @@ var _f = "inbox", vf = 25, yf = 100, bf = "1970-01-01T00:00:00Z", xf = "id,inter
|
|
|
8200
8261
|
};
|
|
8201
8262
|
}
|
|
8202
8263
|
};
|
|
8203
|
-
function
|
|
8264
|
+
function Of(e) {
|
|
8204
8265
|
return {
|
|
8205
|
-
folder: e.folder ??
|
|
8266
|
+
folder: e.folder ?? Sf,
|
|
8206
8267
|
includeDrafts: e.includeDrafts ?? !1,
|
|
8207
|
-
maxMessagesPerPoll: e.maxMessagesPerPoll ??
|
|
8268
|
+
maxMessagesPerPoll: e.maxMessagesPerPoll ?? Cf,
|
|
8208
8269
|
readStatus: e.readStatus ?? "All",
|
|
8209
8270
|
senderAddress: (e.senderAddress ?? "").trim(),
|
|
8210
8271
|
subjectContains: (e.subjectContains ?? "").trim(),
|
|
8211
8272
|
withAttachmentsOnly: e.withAttachmentsOnly ?? !1
|
|
8212
8273
|
};
|
|
8213
8274
|
}
|
|
8214
|
-
async function
|
|
8215
|
-
let n = await
|
|
8275
|
+
async function kf(e, t) {
|
|
8276
|
+
let n = await Ff(e, jf(t.folder), {
|
|
8216
8277
|
$orderby: "receivedDateTime desc",
|
|
8217
8278
|
$select: "id,receivedDateTime",
|
|
8218
|
-
$top:
|
|
8279
|
+
$top: wf
|
|
8219
8280
|
});
|
|
8220
|
-
|
|
8221
|
-
$filter:
|
|
8281
|
+
If(n, "seed marker fetch"), If(await Ff(e, jf(t.folder), {
|
|
8282
|
+
$filter: Mf(t, Tf),
|
|
8222
8283
|
$orderby: "receivedDateTime desc",
|
|
8223
8284
|
$top: 1
|
|
8224
8285
|
}), "seed filter shape check");
|
|
8225
|
-
let r =
|
|
8286
|
+
let r = zf(Rf(n.data));
|
|
8226
8287
|
if (r == null) return {
|
|
8227
8288
|
boundaryMessageIds: [],
|
|
8228
8289
|
lastReceivedDateTime: e.now.toISOString()
|
|
8229
8290
|
};
|
|
8230
|
-
let i =
|
|
8291
|
+
let i = Rf(n.data).filter((e) => Bf(e.receivedDateTime) == r.ms);
|
|
8231
8292
|
return i.length >= t.maxMessagesPerPoll ? {
|
|
8232
8293
|
boundaryMessageIds: [],
|
|
8233
8294
|
lastReceivedDateTime: new Date(r.ms + 1e3).toISOString()
|
|
@@ -8236,26 +8297,26 @@ async function wf(e, t) {
|
|
|
8236
8297
|
lastReceivedDateTime: r.iso
|
|
8237
8298
|
};
|
|
8238
8299
|
}
|
|
8239
|
-
function
|
|
8240
|
-
let n =
|
|
8241
|
-
if (typeof r != "string" ||
|
|
8300
|
+
function Af(t) {
|
|
8301
|
+
let n = Vf(t), r = n?.lastReceivedDateTime;
|
|
8302
|
+
if (typeof r != "string" || Bf(r) == null) throw new e("Outlook checkpoint is invalid; recreate the Trigger.");
|
|
8242
8303
|
let i = n?.boundaryMessageIds;
|
|
8243
8304
|
return {
|
|
8244
8305
|
boundaryMessageIds: Array.isArray(i) ? i.filter((e) => typeof e == "string" && e.length > 0) : [],
|
|
8245
8306
|
lastReceivedDateTime: r
|
|
8246
8307
|
};
|
|
8247
8308
|
}
|
|
8248
|
-
function
|
|
8309
|
+
function jf(e) {
|
|
8249
8310
|
return e.length == 0 ? "/me/messages" : `/me/mailFolders/${encodeURIComponent(e)}/messages`;
|
|
8250
8311
|
}
|
|
8251
|
-
function
|
|
8312
|
+
function Mf(e, t) {
|
|
8252
8313
|
let n = [`receivedDateTime ge ${t}`];
|
|
8253
8314
|
return e.readStatus == "Unread" && n.push("isRead eq false"), e.readStatus == "Read" && n.push("isRead eq true"), e.withAttachmentsOnly && n.push("hasAttachments eq true"), e.senderAddress.length > 0 && n.push(`from/emailAddress/address eq '${e.senderAddress.replaceAll("'", "''")}'`), n.join(" and ");
|
|
8254
8315
|
}
|
|
8255
|
-
function
|
|
8316
|
+
function Nf(e, t) {
|
|
8256
8317
|
return e.isDraft === !0 && !t.includeDrafts ? !1 : t.subjectContains.length == 0 || (e.subject ?? "").toLowerCase().includes(t.subjectContains.toLowerCase());
|
|
8257
8318
|
}
|
|
8258
|
-
function
|
|
8319
|
+
function Pf(e, t) {
|
|
8259
8320
|
return {
|
|
8260
8321
|
dedupeKey: t,
|
|
8261
8322
|
payload: {
|
|
@@ -8278,7 +8339,7 @@ function kf(e, t) {
|
|
|
8278
8339
|
}
|
|
8279
8340
|
};
|
|
8280
8341
|
}
|
|
8281
|
-
async function
|
|
8342
|
+
async function Ff(e, t, r) {
|
|
8282
8343
|
try {
|
|
8283
8344
|
return await e.connector.execute({
|
|
8284
8345
|
endpoint: t,
|
|
@@ -8290,28 +8351,28 @@ async function Af(e, t, r) {
|
|
|
8290
8351
|
throw new n(`Outlook proxy request to ${t} failed.`, { cause: e });
|
|
8291
8352
|
}
|
|
8292
8353
|
}
|
|
8293
|
-
function
|
|
8354
|
+
function If(r, i) {
|
|
8294
8355
|
if (r.status >= 200 && r.status < 300) return;
|
|
8295
|
-
let a =
|
|
8356
|
+
let a = Lf(r.data);
|
|
8296
8357
|
throw r.status == 401 ? new t(`Outlook ${i} rejected the Connection.`) : r.status == 403 && a.has("mailboxnotenabledforrestapi") ? new e("The Outlook mailbox is not reachable through the Graph mail APIs.") : r.status == 403 && (a.has("accessdenied") || a.has("erroraccessdenied")) ? new t(`Outlook ${i} rejected the Connection.`) : r.status == 404 && (a.has("erroritemnotfound") || a.has("itemnotfound")) ? new e("The configured Outlook folder does not exist.") : r.status == 400 && (a.has("errorinvalididmalformed") || a.has("inefficientfilter")) ? new e("Outlook rejected the configured folder or filters.") : new n(`Outlook ${i} failed with status ${r.status}.`);
|
|
8297
8358
|
}
|
|
8298
|
-
function
|
|
8299
|
-
let t = /* @__PURE__ */ new Set(), n =
|
|
8359
|
+
function Lf(e) {
|
|
8360
|
+
let t = /* @__PURE__ */ new Set(), n = Vf(e)?.error;
|
|
8300
8361
|
for (let e = 0; e < 4; e += 1) {
|
|
8301
|
-
let e =
|
|
8362
|
+
let e = Vf(n);
|
|
8302
8363
|
if (e == null) break;
|
|
8303
8364
|
typeof e.code == "string" && e.code.length > 0 && t.add(e.code.toLowerCase()), n = e.innerError ?? e.innererror;
|
|
8304
8365
|
}
|
|
8305
8366
|
return t;
|
|
8306
8367
|
}
|
|
8307
|
-
function
|
|
8308
|
-
let t =
|
|
8368
|
+
function Rf(e) {
|
|
8369
|
+
let t = Vf(e)?.value;
|
|
8309
8370
|
return Array.isArray(t) ? t : [];
|
|
8310
8371
|
}
|
|
8311
|
-
function
|
|
8372
|
+
function zf(e) {
|
|
8312
8373
|
let t = null;
|
|
8313
8374
|
for (let n of e) {
|
|
8314
|
-
let e =
|
|
8375
|
+
let e = Bf(n.receivedDateTime);
|
|
8315
8376
|
n.receivedDateTime != null && e != null && (t == null || e > t.ms) && (t = {
|
|
8316
8377
|
iso: n.receivedDateTime,
|
|
8317
8378
|
ms: e
|
|
@@ -8319,15 +8380,15 @@ function Pf(e) {
|
|
|
8319
8380
|
}
|
|
8320
8381
|
return t;
|
|
8321
8382
|
}
|
|
8322
|
-
function
|
|
8383
|
+
function Bf(e) {
|
|
8323
8384
|
if (e == null || e.length == 0) return null;
|
|
8324
8385
|
let t = Date.parse(e);
|
|
8325
8386
|
return Number.isNaN(t) ? null : t;
|
|
8326
8387
|
}
|
|
8327
|
-
function
|
|
8388
|
+
function Vf(e) {
|
|
8328
8389
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
8329
8390
|
}
|
|
8330
|
-
var
|
|
8391
|
+
var Hf = {
|
|
8331
8392
|
initialState: {
|
|
8332
8393
|
checkpoint: null,
|
|
8333
8394
|
subscription: {}
|
|
@@ -8401,7 +8462,7 @@ var Lf = {
|
|
|
8401
8462
|
outcome: "ignored",
|
|
8402
8463
|
reason: "Shopify topic header is missing."
|
|
8403
8464
|
};
|
|
8404
|
-
if (!
|
|
8465
|
+
if (!Uf(e.config).includes(t)) return {
|
|
8405
8466
|
outcome: "ignored",
|
|
8406
8467
|
reason: "Shopify topic is not subscribed."
|
|
8407
8468
|
};
|
|
@@ -8421,39 +8482,39 @@ var Lf = {
|
|
|
8421
8482
|
};
|
|
8422
8483
|
},
|
|
8423
8484
|
async reconcile(e) {
|
|
8424
|
-
let t =
|
|
8485
|
+
let t = Zf(e.state), n = await Gf(e);
|
|
8425
8486
|
if (n == null) {
|
|
8426
8487
|
if (!e.active) return { outcome: "ready" };
|
|
8427
8488
|
throw new i("The Shopify store or webhook resource is unavailable.");
|
|
8428
8489
|
}
|
|
8429
8490
|
if (!e.active) {
|
|
8430
|
-
for (let t of n.values()) await
|
|
8431
|
-
return await t.saveSubscription({},
|
|
8491
|
+
for (let t of n.values()) await qf(e, t);
|
|
8492
|
+
return await t.saveSubscription({}, Qf(e.now)), { outcome: "ready" };
|
|
8432
8493
|
}
|
|
8433
|
-
let r =
|
|
8494
|
+
let r = Uf(e.config), a = [], o = [];
|
|
8434
8495
|
try {
|
|
8435
8496
|
for (let t of r) {
|
|
8436
8497
|
let r = n.get(t);
|
|
8437
8498
|
if (r != null) a.push(r);
|
|
8438
8499
|
else {
|
|
8439
|
-
let n = await
|
|
8500
|
+
let n = await Wf(e, t);
|
|
8440
8501
|
a.push(n.id), n.created && o.push(n.id);
|
|
8441
8502
|
}
|
|
8442
8503
|
}
|
|
8443
8504
|
} catch (t) {
|
|
8444
|
-
throw await Promise.allSettled(o.map((t) =>
|
|
8505
|
+
throw await Promise.allSettled(o.map((t) => qf(e, t))), t;
|
|
8445
8506
|
}
|
|
8446
|
-
for (let [t, i] of n) r.includes(t) || await
|
|
8447
|
-
return await t.saveSubscription({ webhookIds: a },
|
|
8507
|
+
for (let [t, i] of n) r.includes(t) || await qf(e, i);
|
|
8508
|
+
return await t.saveSubscription({ webhookIds: a }, Qf(e.now)), { outcome: "ready" };
|
|
8448
8509
|
}
|
|
8449
8510
|
};
|
|
8450
|
-
function
|
|
8511
|
+
function Uf(e) {
|
|
8451
8512
|
return [...new Set(e.topics)];
|
|
8452
8513
|
}
|
|
8453
|
-
async function
|
|
8454
|
-
let n = await
|
|
8514
|
+
async function Wf(e, t) {
|
|
8515
|
+
let n = await Jf(e, "subscription create", {
|
|
8455
8516
|
body: { webhook: {
|
|
8456
|
-
address:
|
|
8517
|
+
address: Kf(e),
|
|
8457
8518
|
format: "json",
|
|
8458
8519
|
topic: t
|
|
8459
8520
|
} },
|
|
@@ -8461,22 +8522,22 @@ async function zf(e, t) {
|
|
|
8461
8522
|
method: "POST"
|
|
8462
8523
|
});
|
|
8463
8524
|
if (n.status == 422) {
|
|
8464
|
-
let n = (await
|
|
8525
|
+
let n = (await Gf(e))?.get(t);
|
|
8465
8526
|
if (n != null) return {
|
|
8466
8527
|
created: !1,
|
|
8467
8528
|
id: n
|
|
8468
8529
|
};
|
|
8469
8530
|
}
|
|
8470
|
-
|
|
8471
|
-
let r =
|
|
8531
|
+
Yf(n, "subscription create");
|
|
8532
|
+
let r = Xf($f($f(n.data)?.webhook)?.id);
|
|
8472
8533
|
if (r == null) throw new a("Shopify subscription response is missing its ID.");
|
|
8473
8534
|
return {
|
|
8474
8535
|
created: !0,
|
|
8475
8536
|
id: r
|
|
8476
8537
|
};
|
|
8477
8538
|
}
|
|
8478
|
-
async function
|
|
8479
|
-
let t =
|
|
8539
|
+
async function Gf(e) {
|
|
8540
|
+
let t = Kf(e), n = await Jf(e, "subscription list", {
|
|
8480
8541
|
endpoint: "/webhooks.json",
|
|
8481
8542
|
method: "GET",
|
|
8482
8543
|
query: {
|
|
@@ -8485,34 +8546,34 @@ async function Bf(e) {
|
|
|
8485
8546
|
}
|
|
8486
8547
|
});
|
|
8487
8548
|
if (n.status == 404) return null;
|
|
8488
|
-
|
|
8489
|
-
let r =
|
|
8549
|
+
Yf(n, "subscription list");
|
|
8550
|
+
let r = $f(n.data)?.webhooks, i = /* @__PURE__ */ new Map();
|
|
8490
8551
|
if (!Array.isArray(r)) return i;
|
|
8491
8552
|
for (let e of r) {
|
|
8492
|
-
let n =
|
|
8553
|
+
let n = $f(e), r = Xf(n?.id);
|
|
8493
8554
|
n?.address === t && typeof n.topic == "string" && r != null && i.set(n.topic, r);
|
|
8494
8555
|
}
|
|
8495
8556
|
return i;
|
|
8496
8557
|
}
|
|
8497
|
-
function
|
|
8558
|
+
function Kf(e) {
|
|
8498
8559
|
let t = new URL(e.endpointUrl);
|
|
8499
8560
|
return t.searchParams.set("open_flow_callback", e.callbackSecret), t.href;
|
|
8500
8561
|
}
|
|
8501
|
-
async function
|
|
8502
|
-
let n = await
|
|
8562
|
+
async function qf(e, t) {
|
|
8563
|
+
let n = await Jf(e, "subscription delete", {
|
|
8503
8564
|
endpoint: `/webhooks/${encodeURIComponent(t)}.json`,
|
|
8504
8565
|
method: "DELETE"
|
|
8505
8566
|
});
|
|
8506
|
-
n.status != 404 &&
|
|
8567
|
+
n.status != 404 && Yf(n, "subscription delete");
|
|
8507
8568
|
}
|
|
8508
|
-
async function
|
|
8569
|
+
async function Jf(e, t, n) {
|
|
8509
8570
|
try {
|
|
8510
8571
|
return await e.connector.execute(n, e.signal);
|
|
8511
8572
|
} catch (e) {
|
|
8512
8573
|
throw e instanceof r ? e : new a(`Shopify ${t} request failed.`, { cause: e });
|
|
8513
8574
|
}
|
|
8514
8575
|
}
|
|
8515
|
-
function
|
|
8576
|
+
function Yf(e, t) {
|
|
8516
8577
|
if (!(e.status >= 200 && e.status < 300)) throw e.status == 401 || e.status == 403 ? new r(`Shopify ${t} rejected the Connection.`) : [
|
|
8517
8578
|
402,
|
|
8518
8579
|
404,
|
|
@@ -8521,34 +8582,34 @@ function Wf(e, t) {
|
|
|
8521
8582
|
501
|
|
8522
8583
|
].includes(e.status) ? new i(`Shopify ${t} rejected the subscription.`) : new a(`Shopify ${t} failed with status ${e.status}.`);
|
|
8523
8584
|
}
|
|
8524
|
-
function
|
|
8585
|
+
function Xf(e) {
|
|
8525
8586
|
return typeof e == "string" ? e.trim().length == 0 ? null : e : typeof e == "number" && Number.isFinite(e) ? String(e) : null;
|
|
8526
8587
|
}
|
|
8527
|
-
function
|
|
8588
|
+
function Zf(e) {
|
|
8528
8589
|
if (e == null) throw new i("Shopify Integration state is missing.");
|
|
8529
8590
|
return e;
|
|
8530
8591
|
}
|
|
8531
|
-
function
|
|
8592
|
+
function Qf(e) {
|
|
8532
8593
|
return new Date(e.getTime() + 2592e6);
|
|
8533
8594
|
}
|
|
8534
|
-
function
|
|
8595
|
+
function $f(e) {
|
|
8535
8596
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
8536
8597
|
}
|
|
8537
8598
|
//#endregion
|
|
8538
8599
|
//#region src/trigger/providers/slack/on-message-posted.ts
|
|
8539
|
-
var
|
|
8600
|
+
var ep = 15, tp = 6e4, np = /* @__PURE__ */ new Set([
|
|
8540
8601
|
"file_share",
|
|
8541
8602
|
"thread_broadcast",
|
|
8542
8603
|
"me_message",
|
|
8543
8604
|
"bot_message"
|
|
8544
|
-
]),
|
|
8605
|
+
]), rp = /* @__PURE__ */ new Set([
|
|
8545
8606
|
"invalid_auth",
|
|
8546
8607
|
"not_authed",
|
|
8547
8608
|
"token_revoked",
|
|
8548
8609
|
"token_expired",
|
|
8549
8610
|
"account_inactive",
|
|
8550
8611
|
"two_factor_setup_required"
|
|
8551
|
-
]),
|
|
8612
|
+
]), ip = /* @__PURE__ */ new Set([
|
|
8552
8613
|
"channel_not_found",
|
|
8553
8614
|
"not_in_channel",
|
|
8554
8615
|
"missing_scope",
|
|
@@ -8564,7 +8625,7 @@ var Yf = 15, Xf = 6e4, Zf = /* @__PURE__ */ new Set([
|
|
|
8564
8625
|
"method_deprecated",
|
|
8565
8626
|
"deprecated_endpoint",
|
|
8566
8627
|
"accesslimited"
|
|
8567
|
-
]),
|
|
8628
|
+
]), ap = {
|
|
8568
8629
|
snapshot: {
|
|
8569
8630
|
configSchema: {
|
|
8570
8631
|
additionalProperties: !1,
|
|
@@ -8604,7 +8665,7 @@ var Yf = 15, Xf = 6e4, Zf = /* @__PURE__ */ new Set([
|
|
|
8604
8665
|
type: "boolean"
|
|
8605
8666
|
},
|
|
8606
8667
|
maxMessagesPerPoll: {
|
|
8607
|
-
default:
|
|
8668
|
+
default: ep,
|
|
8608
8669
|
description: "Maximum number of messages processed per poll.",
|
|
8609
8670
|
maximum: 100,
|
|
8610
8671
|
minimum: 1,
|
|
@@ -8678,47 +8739,47 @@ var Yf = 15, Xf = 6e4, Zf = /* @__PURE__ */ new Set([
|
|
|
8678
8739
|
type: "poll"
|
|
8679
8740
|
},
|
|
8680
8741
|
async poll(e) {
|
|
8681
|
-
let t =
|
|
8742
|
+
let t = op(e.config);
|
|
8682
8743
|
if (e.checkpoint === null) return {
|
|
8683
|
-
checkpoint: { lastTs: await
|
|
8744
|
+
checkpoint: { lastTs: await sp(e, t.channelId) },
|
|
8684
8745
|
events: []
|
|
8685
8746
|
};
|
|
8686
|
-
let n =
|
|
8747
|
+
let n = cp(e.checkpoint), r = await lp(e, t, n), i = fp(r), a = [], o = 0;
|
|
8687
8748
|
for (let e of i.toReversed()) {
|
|
8688
|
-
if (!
|
|
8749
|
+
if (!mp(e.message, t)) {
|
|
8689
8750
|
o += 1;
|
|
8690
8751
|
continue;
|
|
8691
8752
|
}
|
|
8692
|
-
a.push(
|
|
8753
|
+
a.push(hp(e, t.channelId));
|
|
8693
8754
|
}
|
|
8694
8755
|
return {
|
|
8695
|
-
checkpoint:
|
|
8756
|
+
checkpoint: pp(n, r, i),
|
|
8696
8757
|
events: a,
|
|
8697
8758
|
filtered: o
|
|
8698
8759
|
};
|
|
8699
8760
|
}
|
|
8700
8761
|
};
|
|
8701
|
-
function
|
|
8762
|
+
function op(e) {
|
|
8702
8763
|
return {
|
|
8703
8764
|
channelId: e.channelId,
|
|
8704
8765
|
fromUserIds: e.fromUserIds ?? [],
|
|
8705
8766
|
ignoreUserIds: e.ignoreUserIds ?? [],
|
|
8706
8767
|
includeBotMessages: e.includeBotMessages ?? !1,
|
|
8707
8768
|
includeSystemMessages: e.includeSystemMessages ?? !1,
|
|
8708
|
-
maxMessagesPerPoll: e.maxMessagesPerPoll ??
|
|
8769
|
+
maxMessagesPerPoll: e.maxMessagesPerPoll ?? ep,
|
|
8709
8770
|
textContains: e.textContains ?? ""
|
|
8710
8771
|
};
|
|
8711
8772
|
}
|
|
8712
|
-
async function
|
|
8713
|
-
let n = await
|
|
8773
|
+
async function sp(e, t) {
|
|
8774
|
+
let n = await up(e, {
|
|
8714
8775
|
channel: t,
|
|
8715
8776
|
limit: 1
|
|
8716
8777
|
});
|
|
8717
|
-
|
|
8778
|
+
dp(n, "baseline history fetch");
|
|
8718
8779
|
let r = n.data.messages?.[0]?.ts;
|
|
8719
|
-
return r != null &&
|
|
8780
|
+
return r != null && gp(r) ? r : `${Math.floor((e.now.getTime() - tp) / 1e3)}.000000`;
|
|
8720
8781
|
}
|
|
8721
|
-
function
|
|
8782
|
+
function cp(t) {
|
|
8722
8783
|
let n = t;
|
|
8723
8784
|
if (typeof n.lastTs != "string" || n.lastTs.length == 0) throw new e("Slack checkpoint lastTs is missing.");
|
|
8724
8785
|
let r = n.drainLatest, i = n.pendingHighTs;
|
|
@@ -8730,17 +8791,17 @@ function rp(t) {
|
|
|
8730
8791
|
pendingHighTs: i
|
|
8731
8792
|
};
|
|
8732
8793
|
}
|
|
8733
|
-
async function
|
|
8734
|
-
let r = await
|
|
8794
|
+
async function lp(e, t, n) {
|
|
8795
|
+
let r = await up(e, {
|
|
8735
8796
|
channel: t.channelId,
|
|
8736
8797
|
inclusive: "false",
|
|
8737
8798
|
latest: n.drainLatest,
|
|
8738
8799
|
limit: t.maxMessagesPerPoll,
|
|
8739
8800
|
oldest: n.lastTs
|
|
8740
8801
|
});
|
|
8741
|
-
return
|
|
8802
|
+
return dp(r, "history list"), r.data;
|
|
8742
8803
|
}
|
|
8743
|
-
async function
|
|
8804
|
+
async function up(e, t) {
|
|
8744
8805
|
try {
|
|
8745
8806
|
return await e.connector.execute({
|
|
8746
8807
|
endpoint: "/conversations.history",
|
|
@@ -8751,19 +8812,19 @@ async function ap(e, t) {
|
|
|
8751
8812
|
throw new n("Slack proxy request failed.", { cause: e });
|
|
8752
8813
|
}
|
|
8753
8814
|
}
|
|
8754
|
-
function
|
|
8815
|
+
function dp(r, i) {
|
|
8755
8816
|
let a = r.data;
|
|
8756
8817
|
if (r.status >= 200 && r.status < 300 && a.ok === !0) return;
|
|
8757
8818
|
let o = typeof a.error == "string" ? a.error : "";
|
|
8758
|
-
throw
|
|
8819
|
+
throw rp.has(o) ? new t(`Slack ${i} rejected with ${o}.`) : ip.has(o) ? new e(`Slack ${i} rejected with ${o}.`) : new n(`Slack ${i} failed with ${o || `status ${r.status}`}.`);
|
|
8759
8820
|
}
|
|
8760
|
-
function
|
|
8761
|
-
return (e.messages ?? []).flatMap((e) => e.ts != null &&
|
|
8821
|
+
function fp(e) {
|
|
8822
|
+
return (e.messages ?? []).flatMap((e) => e.ts != null && gp(e.ts) ? [{
|
|
8762
8823
|
message: e,
|
|
8763
8824
|
ts: e.ts
|
|
8764
8825
|
}] : []);
|
|
8765
8826
|
}
|
|
8766
|
-
function
|
|
8827
|
+
function pp(e, t, r) {
|
|
8767
8828
|
let i = r[0]?.ts, a = r.at(-1)?.ts;
|
|
8768
8829
|
if (t.has_more === !0) {
|
|
8769
8830
|
if (i == null || a == null) throw new n("Slack history reports has_more without a usable timestamp.");
|
|
@@ -8775,10 +8836,10 @@ function cp(e, t, r) {
|
|
|
8775
8836
|
}
|
|
8776
8837
|
return e.pendingHighTs == null ? { lastTs: i ?? e.lastTs } : { lastTs: e.pendingHighTs };
|
|
8777
8838
|
}
|
|
8778
|
-
function
|
|
8779
|
-
return !t.includeBotMessages && (e.bot_id != null || e.subtype == "bot_message") || !t.includeSystemMessages && e.subtype != null && !
|
|
8839
|
+
function mp(e, t) {
|
|
8840
|
+
return !t.includeBotMessages && (e.bot_id != null || e.subtype == "bot_message") || !t.includeSystemMessages && e.subtype != null && !np.has(e.subtype) || t.fromUserIds.length > 0 && (e.user == null || !t.fromUserIds.includes(e.user)) || e.user != null && t.ignoreUserIds.includes(e.user) ? !1 : t.textContains.length == 0 || (e.text ?? "").toLowerCase().includes(t.textContains.toLowerCase());
|
|
8780
8841
|
}
|
|
8781
|
-
function
|
|
8842
|
+
function hp(e, t) {
|
|
8782
8843
|
return {
|
|
8783
8844
|
dedupeKey: `${t}:${e.ts}`,
|
|
8784
8845
|
payload: {
|
|
@@ -8797,12 +8858,12 @@ function up(e, t) {
|
|
|
8797
8858
|
}
|
|
8798
8859
|
};
|
|
8799
8860
|
}
|
|
8800
|
-
function
|
|
8861
|
+
function gp(e) {
|
|
8801
8862
|
return /^\d+(?:\.\d+)?$/.test(e) && !Number.isNaN(new Date(Math.round(Number(e) * 1e3)).getTime());
|
|
8802
8863
|
}
|
|
8803
8864
|
//#endregion
|
|
8804
8865
|
//#region src/trigger/providers/stripe/on-event.ts
|
|
8805
|
-
var
|
|
8866
|
+
var _p = 300, vp = "/v1/webhook_endpoints", yp = { "Content-Type": "application/x-www-form-urlencoded" }, bp = {
|
|
8806
8867
|
initialState: {
|
|
8807
8868
|
checkpoint: null,
|
|
8808
8869
|
subscription: {}
|
|
@@ -8870,8 +8931,8 @@ var fp = 300, pp = "/v1/webhook_endpoints", mp = { "Content-Type": "application/
|
|
|
8870
8931
|
type: "integration"
|
|
8871
8932
|
},
|
|
8872
8933
|
async receive(e) {
|
|
8873
|
-
let t =
|
|
8874
|
-
if (t == null || !await
|
|
8934
|
+
let t = Ap(e.state);
|
|
8935
|
+
if (t == null || !await jp(e.header("stripe-signature"), t, e.rawBody, e.now)) return {
|
|
8875
8936
|
body: "",
|
|
8876
8937
|
contentType: "text/plain",
|
|
8877
8938
|
outcome: "respond",
|
|
@@ -8886,7 +8947,7 @@ var fp = 300, pp = "/v1/webhook_endpoints", mp = { "Content-Type": "application/
|
|
|
8886
8947
|
outcome: "ignored",
|
|
8887
8948
|
reason: "Stripe event identity is missing."
|
|
8888
8949
|
};
|
|
8889
|
-
let a =
|
|
8950
|
+
let a = xp(e.config);
|
|
8890
8951
|
return !a.events.includes("*") && !a.events.includes(r) ? {
|
|
8891
8952
|
outcome: "ignored",
|
|
8892
8953
|
reason: "Stripe event is not subscribed."
|
|
@@ -8902,156 +8963,156 @@ var fp = 300, pp = "/v1/webhook_endpoints", mp = { "Content-Type": "application/
|
|
|
8902
8963
|
};
|
|
8903
8964
|
},
|
|
8904
8965
|
async reconcile(e) {
|
|
8905
|
-
let t =
|
|
8966
|
+
let t = Op(e.state), n = xp(e.config), r = kp(t), i = Ap(t);
|
|
8906
8967
|
if (!e.active) {
|
|
8907
|
-
if (r ??= await
|
|
8908
|
-
let t = await
|
|
8909
|
-
endpoint: `${
|
|
8968
|
+
if (r ??= await wp(e), r != null) {
|
|
8969
|
+
let t = await Tp(e, "endpoint delete", {
|
|
8970
|
+
endpoint: `${vp}/${r}`,
|
|
8910
8971
|
method: "DELETE"
|
|
8911
8972
|
});
|
|
8912
|
-
t.status != 404 &&
|
|
8973
|
+
t.status != 404 && Ep(t, "endpoint delete");
|
|
8913
8974
|
}
|
|
8914
|
-
return await t.saveSubscription({},
|
|
8975
|
+
return await t.saveSubscription({}, Mp(e.now)), { outcome: "ready" };
|
|
8915
8976
|
}
|
|
8916
|
-
if (r ??= await
|
|
8917
|
-
let t = await
|
|
8918
|
-
endpoint: `${
|
|
8977
|
+
if (r ??= await wp(e), r != null && i == null) {
|
|
8978
|
+
let t = await Tp(e, "endpoint delete", {
|
|
8979
|
+
endpoint: `${vp}/${r}`,
|
|
8919
8980
|
method: "DELETE"
|
|
8920
8981
|
});
|
|
8921
|
-
t.status != 404 &&
|
|
8982
|
+
t.status != 404 && Ep(t, "endpoint delete"), r = null;
|
|
8922
8983
|
}
|
|
8923
8984
|
if (r == null) {
|
|
8924
|
-
let t = await
|
|
8925
|
-
body:
|
|
8926
|
-
endpoint:
|
|
8985
|
+
let t = await Tp(e, "endpoint create", {
|
|
8986
|
+
body: Sp(e.endpointUrl, n),
|
|
8987
|
+
endpoint: vp,
|
|
8927
8988
|
headers: {
|
|
8928
|
-
...
|
|
8989
|
+
...yp,
|
|
8929
8990
|
"Idempotency-Key": e.idempotencyKey
|
|
8930
8991
|
},
|
|
8931
8992
|
method: "POST"
|
|
8932
8993
|
});
|
|
8933
|
-
|
|
8934
|
-
let a =
|
|
8994
|
+
Ep(t, "endpoint create");
|
|
8995
|
+
let a = Dp(t.data);
|
|
8935
8996
|
r = a.id, i = a.secret;
|
|
8936
8997
|
}
|
|
8937
|
-
let a = await
|
|
8938
|
-
body:
|
|
8998
|
+
let a = await Tp(e, "endpoint update", {
|
|
8999
|
+
body: Cp([
|
|
8939
9000
|
...n.events.map((e, t) => [`enabled_events[${t}]`, e]),
|
|
8940
9001
|
["disabled", "false"],
|
|
8941
9002
|
["description", "Managed by Open Flow."]
|
|
8942
9003
|
]),
|
|
8943
|
-
endpoint: `${
|
|
8944
|
-
headers:
|
|
9004
|
+
endpoint: `${vp}/${r}`,
|
|
9005
|
+
headers: yp,
|
|
8945
9006
|
method: "POST"
|
|
8946
9007
|
});
|
|
8947
|
-
return a.status == 404 ? (await t.saveSubscription({}, e.now), { outcome: "pending" }) : (
|
|
9008
|
+
return a.status == 404 ? (await t.saveSubscription({}, e.now), { outcome: "pending" }) : (Ep(a, "endpoint update"), await t.saveSubscription({
|
|
8948
9009
|
endpointId: r,
|
|
8949
9010
|
signingSecret: i
|
|
8950
|
-
},
|
|
9011
|
+
}, Mp(e.now)), { outcome: "ready" });
|
|
8951
9012
|
}
|
|
8952
9013
|
};
|
|
8953
|
-
function
|
|
9014
|
+
function xp(e) {
|
|
8954
9015
|
return {
|
|
8955
9016
|
apiVersion: e.apiVersion ?? "",
|
|
8956
9017
|
events: [...new Set(e.events)],
|
|
8957
9018
|
includeConnectedAccounts: e.includeConnectedAccounts ?? !1
|
|
8958
9019
|
};
|
|
8959
9020
|
}
|
|
8960
|
-
function
|
|
9021
|
+
function Sp(e, t) {
|
|
8961
9022
|
let n = [
|
|
8962
9023
|
["url", e],
|
|
8963
9024
|
...t.events.map((e, t) => [`enabled_events[${t}]`, e]),
|
|
8964
9025
|
["description", "Managed by Open Flow."]
|
|
8965
9026
|
];
|
|
8966
|
-
return t.includeConnectedAccounts && n.push(["connect", "true"]), t.apiVersion.length > 0 && n.push(["api_version", t.apiVersion]),
|
|
9027
|
+
return t.includeConnectedAccounts && n.push(["connect", "true"]), t.apiVersion.length > 0 && n.push(["api_version", t.apiVersion]), Cp(n);
|
|
8967
9028
|
}
|
|
8968
|
-
function
|
|
9029
|
+
function Cp(e) {
|
|
8969
9030
|
let t = new URLSearchParams();
|
|
8970
9031
|
for (let [n, r] of e) t.append(n, r);
|
|
8971
9032
|
return t.toString();
|
|
8972
9033
|
}
|
|
8973
|
-
async function
|
|
9034
|
+
async function wp(e) {
|
|
8974
9035
|
let t;
|
|
8975
9036
|
for (let n = 0; n < 10; n += 1) {
|
|
8976
|
-
let n = await
|
|
8977
|
-
endpoint:
|
|
9037
|
+
let n = await Tp(e, "endpoint list", {
|
|
9038
|
+
endpoint: vp,
|
|
8978
9039
|
method: "GET",
|
|
8979
9040
|
query: {
|
|
8980
9041
|
limit: 100,
|
|
8981
9042
|
...t == null ? {} : { starting_after: t }
|
|
8982
9043
|
}
|
|
8983
9044
|
});
|
|
8984
|
-
|
|
8985
|
-
let r =
|
|
9045
|
+
Ep(n, "endpoint list");
|
|
9046
|
+
let r = Np(n.data), i = Array.isArray(r?.data) ? r.data : [];
|
|
8986
9047
|
for (let t of i) {
|
|
8987
|
-
let n =
|
|
9048
|
+
let n = Np(t);
|
|
8988
9049
|
if (n?.url === e.endpointUrl && typeof n.id == "string") return n.id;
|
|
8989
9050
|
}
|
|
8990
|
-
let a =
|
|
9051
|
+
let a = Np(i.at(-1))?.id;
|
|
8991
9052
|
if (r?.has_more !== !0 || typeof a != "string") return null;
|
|
8992
9053
|
t = a;
|
|
8993
9054
|
}
|
|
8994
9055
|
return null;
|
|
8995
9056
|
}
|
|
8996
|
-
async function
|
|
9057
|
+
async function Tp(e, t, n) {
|
|
8997
9058
|
try {
|
|
8998
9059
|
return await e.connector.execute(n, e.signal);
|
|
8999
9060
|
} catch (e) {
|
|
9000
9061
|
throw e instanceof r ? e : new a(`Stripe ${t} request failed.`, { cause: e });
|
|
9001
9062
|
}
|
|
9002
9063
|
}
|
|
9003
|
-
function
|
|
9064
|
+
function Ep(e, t) {
|
|
9004
9065
|
if (!(e.status >= 200 && e.status < 300)) {
|
|
9005
9066
|
if (e.status == 401 || e.status == 403) throw new r(`Stripe ${t} rejected the Connection.`);
|
|
9006
9067
|
if (e.status == 400 || e.status == 404) {
|
|
9007
|
-
let n =
|
|
9068
|
+
let n = Np(Np(e.data)?.error)?.message;
|
|
9008
9069
|
throw new i(`Stripe ${t} rejected the subscription${typeof n == "string" ? `: ${n}` : "."}`);
|
|
9009
9070
|
}
|
|
9010
9071
|
throw new a(`Stripe ${t} failed with status ${e.status}.`);
|
|
9011
9072
|
}
|
|
9012
9073
|
}
|
|
9013
|
-
function
|
|
9014
|
-
let t =
|
|
9074
|
+
function Dp(e) {
|
|
9075
|
+
let t = Np(e);
|
|
9015
9076
|
if (typeof t?.id != "string" || typeof t.secret != "string" || t.secret.length == 0) throw new a("Stripe endpoint response is missing its ID or signing secret.");
|
|
9016
9077
|
return {
|
|
9017
9078
|
id: t.id,
|
|
9018
9079
|
secret: t.secret
|
|
9019
9080
|
};
|
|
9020
9081
|
}
|
|
9021
|
-
function
|
|
9082
|
+
function Op(e) {
|
|
9022
9083
|
if (e == null) throw new i("Stripe Integration state is missing.");
|
|
9023
9084
|
return e;
|
|
9024
9085
|
}
|
|
9025
|
-
function
|
|
9086
|
+
function kp(e) {
|
|
9026
9087
|
let t = e.subscription.endpointId;
|
|
9027
9088
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
9028
9089
|
}
|
|
9029
|
-
function
|
|
9090
|
+
function Ap(e) {
|
|
9030
9091
|
let t = e?.subscription.signingSecret;
|
|
9031
9092
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
9032
9093
|
}
|
|
9033
|
-
async function
|
|
9094
|
+
async function jp(e, t, n, r) {
|
|
9034
9095
|
if (e == null) return !1;
|
|
9035
9096
|
let i = e.split(",").map((e) => e.trim().split("=", 2)), a = i.find(([e]) => e == "t")?.[1];
|
|
9036
9097
|
if (a == null || !/^\d+$/.test(a)) return !1;
|
|
9037
9098
|
let o = Number(a);
|
|
9038
|
-
if (!Number.isSafeInteger(o) || Math.abs(Math.floor(r.getTime() / 1e3) - o) >
|
|
9099
|
+
if (!Number.isSafeInteger(o) || Math.abs(Math.floor(r.getTime() / 1e3) - o) > _p) return !1;
|
|
9039
9100
|
let s = i.filter(([e, t]) => e == "v1" && t != null).map(([, e]) => e), c = [he(`${a}.`), n];
|
|
9040
9101
|
return (await Promise.all(s.map((e) => ve(t, c, e)))).some(Boolean);
|
|
9041
9102
|
}
|
|
9042
|
-
function
|
|
9103
|
+
function Mp(e) {
|
|
9043
9104
|
return new Date(e.getTime() + 2592e6);
|
|
9044
9105
|
}
|
|
9045
|
-
function
|
|
9106
|
+
function Np(e) {
|
|
9046
9107
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
9047
9108
|
}
|
|
9048
9109
|
//#endregion
|
|
9049
9110
|
//#region src/trigger/providers/telegram/on-update.ts
|
|
9050
|
-
var
|
|
9111
|
+
var Pp = /* @__PURE__ */ new Set([
|
|
9051
9112
|
"chat_member",
|
|
9052
9113
|
"message_reaction",
|
|
9053
9114
|
"message_reaction_count"
|
|
9054
|
-
]),
|
|
9115
|
+
]), Fp = /* @__PURE__ */ "*.message.edited_message.channel_post.edited_channel_post.business_connection.business_message.edited_business_message.deleted_business_messages.guest_message.message_reaction.message_reaction_count.inline_query.chosen_inline_result.callback_query.shipping_query.pre_checkout_query.purchased_paid_media.poll.poll_answer.my_chat_member.chat_member.chat_join_request.chat_boost.removed_chat_boost.managed_bot.subscription".split("."), Ip = Fp.filter((e) => e != "*" && !Pp.has(e)), Lp = {
|
|
9055
9116
|
snapshot: {
|
|
9056
9117
|
configSchema: {
|
|
9057
9118
|
additionalProperties: !1,
|
|
@@ -9075,7 +9136,7 @@ var kp = /* @__PURE__ */ new Set([
|
|
|
9075
9136
|
},
|
|
9076
9137
|
updates: {
|
|
9077
9138
|
description: "Telegram update types that trigger a Run. Use * for the Telegram default set.",
|
|
9078
|
-
items: { enum:
|
|
9139
|
+
items: { enum: Fp },
|
|
9079
9140
|
minItems: 1,
|
|
9080
9141
|
type: "array",
|
|
9081
9142
|
uniqueItems: !0
|
|
@@ -9129,13 +9190,13 @@ var kp = /* @__PURE__ */ new Set([
|
|
|
9129
9190
|
type: "integration"
|
|
9130
9191
|
},
|
|
9131
9192
|
receive(e) {
|
|
9132
|
-
if (!
|
|
9193
|
+
if (!Bp(e.header("x-telegram-bot-api-secret-token"), e.callbackSecret)) return {
|
|
9133
9194
|
body: "",
|
|
9134
9195
|
contentType: "text/plain",
|
|
9135
9196
|
outcome: "respond",
|
|
9136
9197
|
status: 404
|
|
9137
9198
|
};
|
|
9138
|
-
if (
|
|
9199
|
+
if (!Vp(e.payload) || !Number.isSafeInteger(e.payload.update_id)) return {
|
|
9139
9200
|
outcome: "ignored",
|
|
9140
9201
|
reason: "Telegram update_id is missing."
|
|
9141
9202
|
};
|
|
@@ -9144,21 +9205,21 @@ var kp = /* @__PURE__ */ new Set([
|
|
|
9144
9205
|
outcome: "ignored",
|
|
9145
9206
|
reason: "Telegram update body is missing."
|
|
9146
9207
|
};
|
|
9147
|
-
let n =
|
|
9148
|
-
if (!(
|
|
9208
|
+
let n = Rp(e.config);
|
|
9209
|
+
if (!(zp(n) ?? Ip).includes(t)) return {
|
|
9149
9210
|
outcome: "ignored",
|
|
9150
9211
|
reason: "Telegram update type is not subscribed."
|
|
9151
9212
|
};
|
|
9152
9213
|
let r = e.payload[t];
|
|
9153
9214
|
if (n.chatIds.length > 0) {
|
|
9154
|
-
let e =
|
|
9215
|
+
let e = Up(r);
|
|
9155
9216
|
if (e == null || !n.chatIds.includes(e)) return {
|
|
9156
9217
|
outcome: "ignored",
|
|
9157
9218
|
reason: "Telegram chat does not match."
|
|
9158
9219
|
};
|
|
9159
9220
|
}
|
|
9160
9221
|
if (n.userIds.length > 0) {
|
|
9161
|
-
let e =
|
|
9222
|
+
let e = Wp(r);
|
|
9162
9223
|
if (e == null || !n.userIds.includes(e)) return {
|
|
9163
9224
|
outcome: "ignored",
|
|
9164
9225
|
reason: "Telegram user does not match."
|
|
@@ -9176,19 +9237,19 @@ var kp = /* @__PURE__ */ new Set([
|
|
|
9176
9237
|
};
|
|
9177
9238
|
},
|
|
9178
9239
|
async reconcile(e) {
|
|
9179
|
-
let t = await
|
|
9180
|
-
if (!e.active) return t == e.endpointUrl && await
|
|
9181
|
-
if (t != "" && t != e.endpointUrl) throw new i(`The Telegram bot already sends updates to ${
|
|
9182
|
-
let n =
|
|
9183
|
-
return await
|
|
9184
|
-
allowed_updates:
|
|
9240
|
+
let t = await Gp(e);
|
|
9241
|
+
if (!e.active) return t == e.endpointUrl && await Kp(e), { outcome: "ready" };
|
|
9242
|
+
if (t != "" && t != e.endpointUrl) throw new i(`The Telegram bot already sends updates to ${Jp(t)}.`);
|
|
9243
|
+
let n = Rp(e.config);
|
|
9244
|
+
return await qp(e, "setWebhook", {
|
|
9245
|
+
allowed_updates: zp(n) ?? [],
|
|
9185
9246
|
drop_pending_updates: t == "" && n.dropPendingUpdates,
|
|
9186
9247
|
secret_token: e.callbackSecret,
|
|
9187
9248
|
url: e.endpointUrl
|
|
9188
9249
|
}), { outcome: "ready" };
|
|
9189
9250
|
}
|
|
9190
9251
|
};
|
|
9191
|
-
function
|
|
9252
|
+
function Rp(e) {
|
|
9192
9253
|
return {
|
|
9193
9254
|
chatIds: e.chatIds ?? [],
|
|
9194
9255
|
dropPendingUpdates: e.dropPendingUpdates ?? !0,
|
|
@@ -9196,38 +9257,38 @@ function Np(e) {
|
|
|
9196
9257
|
userIds: e.userIds ?? []
|
|
9197
9258
|
};
|
|
9198
9259
|
}
|
|
9199
|
-
function
|
|
9260
|
+
function zp(e) {
|
|
9200
9261
|
if (!e.updates.includes("*")) return e.updates;
|
|
9201
9262
|
let t = e.updates.filter((e) => e != "*");
|
|
9202
|
-
return t.length == 0 ? null : [.../* @__PURE__ */ new Set([...
|
|
9263
|
+
return t.length == 0 ? null : [.../* @__PURE__ */ new Set([...Ip, ...t])];
|
|
9203
9264
|
}
|
|
9204
|
-
function
|
|
9265
|
+
function Bp(e, t) {
|
|
9205
9266
|
if (e == null || e.length != t.length) return !1;
|
|
9206
9267
|
let n = 0;
|
|
9207
9268
|
for (let r = 0; r < t.length; r += 1) n |= e.charCodeAt(r) ^ t.charCodeAt(r);
|
|
9208
9269
|
return n == 0;
|
|
9209
9270
|
}
|
|
9210
|
-
function
|
|
9271
|
+
function Vp(e) {
|
|
9211
9272
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
9212
9273
|
}
|
|
9213
|
-
function
|
|
9214
|
-
if (
|
|
9274
|
+
function Hp(e) {
|
|
9275
|
+
if (Vp(e)) return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : void 0;
|
|
9215
9276
|
}
|
|
9216
|
-
function
|
|
9217
|
-
if (
|
|
9277
|
+
function Up(e) {
|
|
9278
|
+
if (Vp(e)) return Hp(e.chat) ?? (Vp(e.message) ? Hp(e.message.chat) : void 0);
|
|
9218
9279
|
}
|
|
9219
|
-
function
|
|
9220
|
-
if (
|
|
9280
|
+
function Wp(e) {
|
|
9281
|
+
if (Vp(e)) return Hp(e.from) ?? Hp(e.user);
|
|
9221
9282
|
}
|
|
9222
|
-
async function
|
|
9223
|
-
let t = await
|
|
9283
|
+
async function Gp(e) {
|
|
9284
|
+
let t = await qp(e, "getWebhookInfo"), n = Vp(t.result) ? t.result.url : void 0;
|
|
9224
9285
|
if (typeof n != "string") throw new a("Telegram getWebhookInfo response is missing result.url.");
|
|
9225
9286
|
return n;
|
|
9226
9287
|
}
|
|
9227
|
-
async function
|
|
9228
|
-
await
|
|
9288
|
+
async function Kp(e) {
|
|
9289
|
+
await qp(e, "deleteWebhook", { drop_pending_updates: !1 });
|
|
9229
9290
|
}
|
|
9230
|
-
async function
|
|
9291
|
+
async function qp(e, t, n) {
|
|
9231
9292
|
let o;
|
|
9232
9293
|
try {
|
|
9233
9294
|
o = await e.connector.execute({
|
|
@@ -9238,19 +9299,19 @@ async function Vp(e, t, n) {
|
|
|
9238
9299
|
} catch (e) {
|
|
9239
9300
|
throw e instanceof r ? e : new a(`Telegram ${t} request failed.`, { cause: e });
|
|
9240
9301
|
}
|
|
9241
|
-
let s =
|
|
9302
|
+
let s = Vp(o.data) ? o.data : {};
|
|
9242
9303
|
if (o.status >= 200 && o.status < 300 && s.ok === !0) return s;
|
|
9243
9304
|
let c = typeof s.description == "string" ? s.description : `HTTP ${o.status}`;
|
|
9244
9305
|
throw o.status == 401 || o.status == 403 ? new r(`Telegram ${t} rejected the Connection.`) : o.status >= 400 && o.status < 500 && o.status != 429 ? new i(`Telegram ${t} rejected the subscription: ${c}`) : new a(`Telegram ${t} failed: ${c}`);
|
|
9245
9306
|
}
|
|
9246
|
-
function
|
|
9307
|
+
function Jp(e) {
|
|
9247
9308
|
try {
|
|
9248
9309
|
return new URL(e).host;
|
|
9249
9310
|
} catch {
|
|
9250
9311
|
return "an invalid URL";
|
|
9251
9312
|
}
|
|
9252
9313
|
}
|
|
9253
|
-
var
|
|
9314
|
+
var Yp = {
|
|
9254
9315
|
initialState: {
|
|
9255
9316
|
checkpoint: null,
|
|
9256
9317
|
subscription: {}
|
|
@@ -9349,7 +9410,7 @@ var Up = {
|
|
|
9349
9410
|
outcome: "ignored",
|
|
9350
9411
|
reason: "WooCommerce topic header is missing."
|
|
9351
9412
|
};
|
|
9352
|
-
if (!
|
|
9413
|
+
if (!Xp(e.config).events.includes(t)) return {
|
|
9353
9414
|
outcome: "ignored",
|
|
9354
9415
|
reason: "WooCommerce topic is not subscribed."
|
|
9355
9416
|
};
|
|
@@ -9369,31 +9430,31 @@ var Up = {
|
|
|
9369
9430
|
};
|
|
9370
9431
|
},
|
|
9371
9432
|
async reconcile(e) {
|
|
9372
|
-
let t =
|
|
9433
|
+
let t = sm(e.state), n = Xp(e.config), r = await $p(e);
|
|
9373
9434
|
if (!e.active) {
|
|
9374
|
-
for (let t of r) await
|
|
9375
|
-
return await t.saveSubscription({},
|
|
9435
|
+
for (let t of r) await em(e, t.id);
|
|
9436
|
+
return await t.saveSubscription({}, cm(e.now)), { outcome: "ready" };
|
|
9376
9437
|
}
|
|
9377
9438
|
let i = /* @__PURE__ */ new Map();
|
|
9378
9439
|
for (let e of r) n.events.includes(e.topic) && !i.has(e.topic) && i.set(e.topic, e.id);
|
|
9379
9440
|
let a = new Set(i.values());
|
|
9380
|
-
for (let t of r) a.has(t.id) || await
|
|
9441
|
+
for (let t of r) a.has(t.id) || await em(e, t.id);
|
|
9381
9442
|
let o = [];
|
|
9382
9443
|
for (let t of n.events) {
|
|
9383
9444
|
let r = i.get(t);
|
|
9384
|
-
o.push(r == null ? await
|
|
9445
|
+
o.push(r == null ? await Zp(e, n, t) : await Qp(e, r, t));
|
|
9385
9446
|
}
|
|
9386
|
-
return await t.saveSubscription({ webhookIds: o },
|
|
9447
|
+
return await t.saveSubscription({ webhookIds: o }, cm(e.now)), { outcome: "ready" };
|
|
9387
9448
|
}
|
|
9388
9449
|
};
|
|
9389
|
-
function
|
|
9450
|
+
function Xp(e) {
|
|
9390
9451
|
return {
|
|
9391
9452
|
events: [...new Set(e.events)],
|
|
9392
9453
|
webhookName: e.webhookName ?? "OOMOL Trigger"
|
|
9393
9454
|
};
|
|
9394
9455
|
}
|
|
9395
|
-
async function
|
|
9396
|
-
let r = await
|
|
9456
|
+
async function Zp(e, t, n) {
|
|
9457
|
+
let r = await tm(e, `webhook create (${n})`, {
|
|
9397
9458
|
body: {
|
|
9398
9459
|
delivery_url: e.endpointUrl,
|
|
9399
9460
|
name: `${t.webhookName} - ${n}`,
|
|
@@ -9403,10 +9464,10 @@ async function Gp(e, t, n) {
|
|
|
9403
9464
|
endpoint: "/webhooks",
|
|
9404
9465
|
method: "POST"
|
|
9405
9466
|
});
|
|
9406
|
-
return
|
|
9467
|
+
return nm(r, `webhook create (${n})`), am(r.data);
|
|
9407
9468
|
}
|
|
9408
|
-
async function
|
|
9409
|
-
let r = await
|
|
9469
|
+
async function Qp(e, t, n) {
|
|
9470
|
+
let r = await tm(e, `webhook update (${n})`, {
|
|
9410
9471
|
body: {
|
|
9411
9472
|
delivery_url: e.endpointUrl,
|
|
9412
9473
|
secret: e.callbackSecret,
|
|
@@ -9416,12 +9477,12 @@ async function Kp(e, t, n) {
|
|
|
9416
9477
|
endpoint: `/webhooks/${t}`,
|
|
9417
9478
|
method: "PUT"
|
|
9418
9479
|
});
|
|
9419
|
-
return
|
|
9480
|
+
return rm(r) ? Zp(e, Xp(e.config), n) : (nm(r, `webhook update (${n})`), t);
|
|
9420
9481
|
}
|
|
9421
|
-
async function
|
|
9482
|
+
async function $p(e) {
|
|
9422
9483
|
let t = [];
|
|
9423
9484
|
for (let n = 1; n <= 10; n += 1) {
|
|
9424
|
-
let r = await
|
|
9485
|
+
let r = await tm(e, "webhook list", {
|
|
9425
9486
|
endpoint: "/webhooks",
|
|
9426
9487
|
method: "GET",
|
|
9427
9488
|
query: {
|
|
@@ -9431,12 +9492,12 @@ async function qp(e) {
|
|
|
9431
9492
|
status: "all"
|
|
9432
9493
|
}
|
|
9433
9494
|
});
|
|
9434
|
-
|
|
9495
|
+
nm(r, "webhook list");
|
|
9435
9496
|
let i = Array.isArray(r.data) ? r.data : [];
|
|
9436
9497
|
for (let n of i) {
|
|
9437
|
-
let r =
|
|
9498
|
+
let r = lm(n);
|
|
9438
9499
|
if (r?.delivery_url !== e.endpointUrl || typeof r.topic != "string") continue;
|
|
9439
|
-
let i =
|
|
9500
|
+
let i = om(r.id);
|
|
9440
9501
|
i != null && t.push({
|
|
9441
9502
|
id: i,
|
|
9442
9503
|
topic: r.topic
|
|
@@ -9446,54 +9507,54 @@ async function qp(e) {
|
|
|
9446
9507
|
}
|
|
9447
9508
|
throw new a("WooCommerce webhook list did not finish within ten pages.");
|
|
9448
9509
|
}
|
|
9449
|
-
async function
|
|
9450
|
-
let n = await
|
|
9510
|
+
async function em(e, t) {
|
|
9511
|
+
let n = await tm(e, "webhook delete", {
|
|
9451
9512
|
endpoint: `/webhooks/${t}`,
|
|
9452
9513
|
method: "DELETE",
|
|
9453
9514
|
query: { force: "true" }
|
|
9454
9515
|
});
|
|
9455
|
-
n.status != 404 &&
|
|
9516
|
+
n.status != 404 && nm(n, "webhook delete");
|
|
9456
9517
|
}
|
|
9457
|
-
async function
|
|
9518
|
+
async function tm(e, t, n) {
|
|
9458
9519
|
try {
|
|
9459
9520
|
return await e.connector.execute(n, e.signal);
|
|
9460
9521
|
} catch (e) {
|
|
9461
9522
|
throw e instanceof r ? e : new a(`WooCommerce ${t} request failed.`, { cause: e });
|
|
9462
9523
|
}
|
|
9463
9524
|
}
|
|
9464
|
-
function
|
|
9525
|
+
function nm(e, t) {
|
|
9465
9526
|
if (e.status >= 200 && e.status < 300) return;
|
|
9466
|
-
let n =
|
|
9527
|
+
let n = im(e.data);
|
|
9467
9528
|
throw e.status == 401 || e.status == 403 ? new r(`WooCommerce ${t} rejected the Connection.`) : e.status == 404 || e.status == 400 && (n.endsWith("_invalid_topic") || n.endsWith("_invalid_delivery_url")) || e.status == 501 && n == "woocommerce_rest_trash_not_supported" ? new i(`WooCommerce ${t} rejected the subscription.`) : new a(`WooCommerce ${t} failed with status ${e.status}.`);
|
|
9468
9529
|
}
|
|
9469
|
-
function
|
|
9470
|
-
return e.status == 400 &&
|
|
9530
|
+
function rm(e) {
|
|
9531
|
+
return e.status == 400 && im(e.data) == "woocommerce_rest_webhook_invalid_id";
|
|
9471
9532
|
}
|
|
9472
|
-
function
|
|
9473
|
-
let t =
|
|
9533
|
+
function im(e) {
|
|
9534
|
+
let t = lm(e)?.code;
|
|
9474
9535
|
return typeof t == "string" ? t : "";
|
|
9475
9536
|
}
|
|
9476
|
-
function
|
|
9477
|
-
let t =
|
|
9537
|
+
function am(e) {
|
|
9538
|
+
let t = om(lm(e)?.id);
|
|
9478
9539
|
if (t == null) throw new a("WooCommerce webhook response is missing its ID.");
|
|
9479
9540
|
return t;
|
|
9480
9541
|
}
|
|
9481
|
-
function
|
|
9542
|
+
function om(e) {
|
|
9482
9543
|
return typeof e == "string" && e.length > 0 ? e : typeof e == "number" && Number.isFinite(e) ? String(e) : null;
|
|
9483
9544
|
}
|
|
9484
|
-
function
|
|
9545
|
+
function sm(e) {
|
|
9485
9546
|
if (e == null) throw new i("WooCommerce Integration state is missing.");
|
|
9486
9547
|
return e;
|
|
9487
9548
|
}
|
|
9488
|
-
function
|
|
9549
|
+
function cm(e) {
|
|
9489
9550
|
return new Date(e.getTime() + 2592e6);
|
|
9490
9551
|
}
|
|
9491
|
-
function
|
|
9552
|
+
function lm(e) {
|
|
9492
9553
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
9493
9554
|
}
|
|
9494
9555
|
//#endregion
|
|
9495
9556
|
//#region src/trigger/providers/zendesk/on-event.ts
|
|
9496
|
-
var
|
|
9557
|
+
var um = 3e5, dm = /* @__PURE__ */ "zen:event-type:ticket.agent_assignment_changed,zen:event-type:ticket.attachment_linked_to_comment,zen:event-type:ticket.attachment_redacted_from_comment,zen:event-type:ticket.brand_changed,zen:event-type:ticket.comment_added,zen:event-type:ticket.comment_made_private,zen:event-type:ticket.comment_redacted,zen:event-type:ticket.created,zen:event-type:ticket.csat_received,zen:event-type:ticket.csat_requested,zen:event-type:ticket.custom_field_changed,zen:event-type:ticket.custom_status_changed,zen:event-type:ticket.description_changed,zen:event-type:ticket.email_ccs_changed,zen:event-type:ticket.external_id_changed,zen:event-type:ticket.followers_changed,zen:event-type:ticket.form_changed,zen:event-type:ticket.group_assignment_changed,zen:event-type:ticket.marked_as_spam,zen:event-type:ticket.merged,zen:event-type:ticket.next_sla_breach_changed,zen:event-type:ticket.ola_policy_changed,zen:event-type:ticket.organization_changed,zen:event-type:ticket.permanently_deleted,zen:event-type:ticket.priority_changed,zen:event-type:ticket.problem_link_changed,zen:event-type:ticket.requester_changed,zen:event-type:ticket.schedule_changed,zen:event-type:ticket.sla_policy_changed,zen:event-type:ticket.soft_deleted,zen:event-type:ticket.status_changed,zen:event-type:ticket.subject_changed,zen:event-type:ticket.submitter_changed,zen:event-type:ticket.tags_changed,zen:event-type:ticket.task_due_at_changed,zen:event-type:ticket.type_changed,zen:event-type:ticket.undeleted,zen:event-type:organization.created,zen:event-type:organization.custom_field_changed,zen:event-type:organization.deleted,zen:event-type:organization.external_id_changed,zen:event-type:organization.name_changed,zen:event-type:organization.tags_changed,zen:event-type:user.active_changed,zen:event-type:user.alias_changed,zen:event-type:user.created,zen:event-type:user.custom_field_changed,zen:event-type:user.custom_role_changed,zen:event-type:user.default_group_changed,zen:event-type:user.deleted,zen:event-type:user.details_changed,zen:event-type:user.external_id_changed,zen:event-type:user.group_membership_created,zen:event-type:user.group_membership_deleted,zen:event-type:user.identity_changed,zen:event-type:user.identity_created,zen:event-type:user.identity_deleted,zen:event-type:user.last_login_changed,zen:event-type:user.merged,zen:event-type:user.name_changed,zen:event-type:user.notes_changed,zen:event-type:user.only_private_comments_changed,zen:event-type:user.organization_membership_created,zen:event-type:user.organization_membership_deleted,zen:event-type:user.password_changed,zen:event-type:user.photo_changed,zen:event-type:user.role_changed,zen:event-type:user.suspended_changed,zen:event-type:user.tags_changed,zen:event-type:user.time_zone_changed".split(","), fm = "/api/v2/webhooks", pm = {
|
|
9497
9558
|
initialState: {
|
|
9498
9559
|
checkpoint: null,
|
|
9499
9560
|
subscription: {}
|
|
@@ -9503,7 +9564,7 @@ var im = 3e5, am = /* @__PURE__ */ "zen:event-type:ticket.agent_assignment_chang
|
|
|
9503
9564
|
additionalProperties: !1,
|
|
9504
9565
|
properties: { events: {
|
|
9505
9566
|
items: {
|
|
9506
|
-
enum:
|
|
9567
|
+
enum: dm,
|
|
9507
9568
|
type: "string"
|
|
9508
9569
|
},
|
|
9509
9570
|
minItems: 1,
|
|
@@ -9548,8 +9609,8 @@ var im = 3e5, am = /* @__PURE__ */ "zen:event-type:ticket.agent_assignment_chang
|
|
|
9548
9609
|
type: "integration"
|
|
9549
9610
|
},
|
|
9550
9611
|
async receive(e) {
|
|
9551
|
-
let t =
|
|
9552
|
-
if (t == null || n == null || !Number.isFinite(r) || Math.abs(e.now.getTime() - r) >
|
|
9612
|
+
let t = Cm(e.state), n = e.header("x-zendesk-webhook-signature-timestamp"), r = n == null ? NaN : Date.parse(n);
|
|
9613
|
+
if (t == null || n == null || !Number.isFinite(r) || Math.abs(e.now.getTime() - r) > um || !await _e(t, [he(n), e.rawBody], e.header("x-zendesk-webhook-signature"))) return {
|
|
9553
9614
|
body: "",
|
|
9554
9615
|
contentType: "text/plain",
|
|
9555
9616
|
outcome: "respond",
|
|
@@ -9581,149 +9642,149 @@ var im = 3e5, am = /* @__PURE__ */ "zen:event-type:ticket.agent_assignment_chang
|
|
|
9581
9642
|
};
|
|
9582
9643
|
},
|
|
9583
9644
|
async reconcile(e) {
|
|
9584
|
-
let t =
|
|
9645
|
+
let t = xm(e.state), n = await hm(e), r = Sm(t);
|
|
9585
9646
|
if (!e.active) {
|
|
9586
|
-
for (let t of r == null ? n : [.../* @__PURE__ */ new Set([r, ...n])]) await
|
|
9587
|
-
return await t.saveSubscription({},
|
|
9647
|
+
for (let t of r == null ? n : [.../* @__PURE__ */ new Set([r, ...n])]) await gm(e, t);
|
|
9648
|
+
return await t.saveSubscription({}, Tm(e.now)), { outcome: "ready" };
|
|
9588
9649
|
}
|
|
9589
9650
|
let i = r ?? n[0];
|
|
9590
9651
|
if (i == null) {
|
|
9591
|
-
let t = await
|
|
9592
|
-
body:
|
|
9593
|
-
endpoint:
|
|
9652
|
+
let t = await _m(e, "webhook create", {
|
|
9653
|
+
body: mm(e),
|
|
9654
|
+
endpoint: fm,
|
|
9594
9655
|
method: "POST"
|
|
9595
9656
|
});
|
|
9596
|
-
|
|
9657
|
+
vm(t, "webhook create"), i = bm(Em(t.data)?.webhook);
|
|
9597
9658
|
} else {
|
|
9598
|
-
let n = await
|
|
9599
|
-
body:
|
|
9600
|
-
endpoint: `${
|
|
9659
|
+
let n = await _m(e, "webhook update", {
|
|
9660
|
+
body: mm(e),
|
|
9661
|
+
endpoint: `${fm}/${i}`,
|
|
9601
9662
|
method: "PUT"
|
|
9602
9663
|
});
|
|
9603
9664
|
if (n.status == 404) return await t.saveSubscription({}, e.now), { outcome: "pending" };
|
|
9604
|
-
|
|
9665
|
+
vm(n, "webhook update");
|
|
9605
9666
|
}
|
|
9606
|
-
for (let t of n.filter((e) => e != i)) await
|
|
9667
|
+
for (let t of n.filter((e) => e != i)) await gm(e, t);
|
|
9607
9668
|
return await t.saveSubscription({
|
|
9608
|
-
signingSecret: await
|
|
9669
|
+
signingSecret: await wm(e, i),
|
|
9609
9670
|
webhookId: i
|
|
9610
|
-
},
|
|
9671
|
+
}, Tm(e.now)), { outcome: "ready" };
|
|
9611
9672
|
}
|
|
9612
9673
|
};
|
|
9613
|
-
function
|
|
9674
|
+
function mm(e) {
|
|
9614
9675
|
return { webhook: {
|
|
9615
9676
|
description: "Managed by Open Flow. Do not edit.",
|
|
9616
9677
|
endpoint: e.endpointUrl,
|
|
9617
9678
|
http_method: "POST",
|
|
9618
|
-
name:
|
|
9679
|
+
name: ym(e.endpointUrl),
|
|
9619
9680
|
request_format: "json",
|
|
9620
9681
|
status: "active",
|
|
9621
9682
|
subscriptions: [...new Set(e.config.events)]
|
|
9622
9683
|
} };
|
|
9623
9684
|
}
|
|
9624
|
-
async function
|
|
9685
|
+
async function hm(e) {
|
|
9625
9686
|
let t = [], n;
|
|
9626
9687
|
for (let r = 0; r < 10; r += 1) {
|
|
9627
|
-
let r = await
|
|
9628
|
-
endpoint:
|
|
9688
|
+
let r = await _m(e, "webhook list", {
|
|
9689
|
+
endpoint: fm,
|
|
9629
9690
|
method: "GET",
|
|
9630
9691
|
query: {
|
|
9631
|
-
"filter[name_contains]":
|
|
9692
|
+
"filter[name_contains]": ym(e.endpointUrl),
|
|
9632
9693
|
"page[size]": "100",
|
|
9633
9694
|
...n == null ? {} : { "page[after]": n }
|
|
9634
9695
|
}
|
|
9635
9696
|
});
|
|
9636
|
-
|
|
9637
|
-
let i =
|
|
9697
|
+
vm(r, "webhook list");
|
|
9698
|
+
let i = Em(r.data), a = Array.isArray(i?.webhooks) ? i.webhooks : [];
|
|
9638
9699
|
for (let n of a) {
|
|
9639
|
-
let r =
|
|
9700
|
+
let r = Em(n);
|
|
9640
9701
|
r?.endpoint === e.endpointUrl && typeof r.id == "string" && t.push(r.id);
|
|
9641
9702
|
}
|
|
9642
|
-
let o =
|
|
9703
|
+
let o = Em(i?.meta);
|
|
9643
9704
|
if (o?.has_more !== !0 || typeof o.after_cursor != "string") return t;
|
|
9644
9705
|
n = o.after_cursor;
|
|
9645
9706
|
}
|
|
9646
9707
|
return t;
|
|
9647
9708
|
}
|
|
9648
|
-
async function
|
|
9649
|
-
let n = await
|
|
9650
|
-
endpoint: `${
|
|
9709
|
+
async function gm(e, t) {
|
|
9710
|
+
let n = await _m(e, "webhook delete", {
|
|
9711
|
+
endpoint: `${fm}/${t}`,
|
|
9651
9712
|
method: "DELETE"
|
|
9652
9713
|
});
|
|
9653
|
-
n.status != 404 &&
|
|
9714
|
+
n.status != 404 && vm(n, "webhook delete");
|
|
9654
9715
|
}
|
|
9655
|
-
async function
|
|
9716
|
+
async function _m(e, t, n) {
|
|
9656
9717
|
try {
|
|
9657
9718
|
return await e.connector.execute(n, e.signal);
|
|
9658
9719
|
} catch (e) {
|
|
9659
9720
|
throw e instanceof r ? e : new a(`Zendesk ${t} request failed.`, { cause: e });
|
|
9660
9721
|
}
|
|
9661
9722
|
}
|
|
9662
|
-
function
|
|
9723
|
+
function vm(e, t) {
|
|
9663
9724
|
if (!(e.status >= 200 && e.status < 300)) throw e.status == 401 || e.status == 403 ? new r(`Zendesk ${t} rejected the Connection.`) : [
|
|
9664
9725
|
400,
|
|
9665
9726
|
404,
|
|
9666
9727
|
422
|
|
9667
9728
|
].includes(e.status) ? new i(`Zendesk ${t} rejected the subscription.`) : new a(`Zendesk ${t} failed with status ${e.status}.`);
|
|
9668
9729
|
}
|
|
9669
|
-
function
|
|
9730
|
+
function ym(e) {
|
|
9670
9731
|
return `open-flow-${e.slice(e.lastIndexOf("/") + 1)}`;
|
|
9671
9732
|
}
|
|
9672
|
-
function
|
|
9673
|
-
let t =
|
|
9733
|
+
function bm(e) {
|
|
9734
|
+
let t = Em(e)?.id;
|
|
9674
9735
|
if (typeof t != "string") throw new a("Zendesk webhook response is missing its ID.");
|
|
9675
9736
|
return t;
|
|
9676
9737
|
}
|
|
9677
|
-
function
|
|
9738
|
+
function xm(e) {
|
|
9678
9739
|
if (e == null) throw new i("Zendesk Integration state is missing.");
|
|
9679
9740
|
return e;
|
|
9680
9741
|
}
|
|
9681
|
-
function
|
|
9742
|
+
function Sm(e) {
|
|
9682
9743
|
let t = e.subscription.webhookId;
|
|
9683
9744
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
9684
9745
|
}
|
|
9685
|
-
function
|
|
9746
|
+
function Cm(e) {
|
|
9686
9747
|
let t = e?.subscription.signingSecret;
|
|
9687
9748
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
9688
9749
|
}
|
|
9689
|
-
async function
|
|
9690
|
-
let n = await
|
|
9691
|
-
endpoint: `${
|
|
9750
|
+
async function wm(e, t) {
|
|
9751
|
+
let n = await _m(e, "webhook signing secret", {
|
|
9752
|
+
endpoint: `${fm}/${t}/signing_secret`,
|
|
9692
9753
|
method: "GET"
|
|
9693
9754
|
});
|
|
9694
|
-
|
|
9695
|
-
let r =
|
|
9755
|
+
vm(n, "webhook signing secret");
|
|
9756
|
+
let r = Em(Em(n.data)?.signing_secret)?.secret;
|
|
9696
9757
|
if (typeof r != "string" || r.length == 0) throw new a("Zendesk webhook signing secret response is invalid.");
|
|
9697
9758
|
return r;
|
|
9698
9759
|
}
|
|
9699
|
-
function
|
|
9760
|
+
function Tm(e) {
|
|
9700
9761
|
return new Date(e.getTime() + 2592e6);
|
|
9701
9762
|
}
|
|
9702
|
-
function
|
|
9763
|
+
function Em(e) {
|
|
9703
9764
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
9704
9765
|
}
|
|
9705
9766
|
//#endregion
|
|
9706
9767
|
//#region src/trigger/providers/definitions.ts
|
|
9707
|
-
var
|
|
9768
|
+
var Dm = [
|
|
9708
9769
|
s,
|
|
9709
|
-
|
|
9770
|
+
Ll,
|
|
9710
9771
|
Ce,
|
|
9711
|
-
ml,
|
|
9712
9772
|
vl,
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9773
|
+
Sl,
|
|
9774
|
+
tu,
|
|
9775
|
+
Tu,
|
|
9776
|
+
Ku,
|
|
9777
|
+
Zu,
|
|
9778
|
+
vd,
|
|
9779
|
+
Fd,
|
|
9780
|
+
af,
|
|
9781
|
+
Df,
|
|
9782
|
+
Hf,
|
|
9783
|
+
ap,
|
|
9784
|
+
bp,
|
|
9785
|
+
Lp,
|
|
9786
|
+
Yp,
|
|
9787
|
+
pm
|
|
9788
|
+
], Om = Dm.filter((e) => e.snapshot.type == "poll"), km = Dm.filter((e) => e.snapshot.type == "integration");
|
|
9728
9789
|
//#endregion
|
|
9729
|
-
export {
|
|
9790
|
+
export { km as integrationDefinitions, Om as pollDefinitions, Dm as triggerDefinitions };
|