@diagonal-hq/cli 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -2
- package/dist/cli.mjs +215 -31
- package/dist/index.d.ts +64 -0
- package/dist/index.js +2 -0
- package/dist/sdk-contract.d.ts +24 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -157,6 +157,13 @@ export type PageAuthorizer =
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
export type PageDefinition = {
|
|
160
|
+
/**
|
|
161
|
+
* The page's identity, unique in the workspace: a camelCase name of at most
|
|
162
|
+
* 64 letters and digits that starts with a lowercase letter, such as
|
|
163
|
+
* `members`. Code links to the page as `Pages.<key>`. A file move keeps the
|
|
164
|
+
* key, and a key change is an identity change.
|
|
165
|
+
*/
|
|
166
|
+
key: string;
|
|
160
167
|
/** The URL pattern. Route parameters use `{name}`, for example `/members/{id}`. */
|
|
161
168
|
route: string;
|
|
162
169
|
/** The name in the admin. Defaults to the title. */
|
|
@@ -387,3 +394,60 @@ export type EmailLayoutDefinition = {
|
|
|
387
394
|
};
|
|
388
395
|
|
|
389
396
|
export declare function defineEmailLayout<const T extends EmailLayoutDefinition>(layout: T): T;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* When a schedule sends. `'day'` sends at 8 a.m. in the workspace timezone on
|
|
400
|
+
* the day. `'exact'` sends at the event start plus the offset, and needs an
|
|
401
|
+
* event schedule field.
|
|
402
|
+
*/
|
|
403
|
+
export type NotificationScheduleTiming = 'day' | 'exact';
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* A `notifications/<type key>/<key>.schedule.ts` file. A schedule sends one
|
|
407
|
+
* template of its type on dates of a resource, for example 7 days after each
|
|
408
|
+
* member's `joined_on`. The deployed schedule is a System Notification: it
|
|
409
|
+
* sends with no staff identity, and `filters` decides who gets it. The file
|
|
410
|
+
* holds the rule. The workspace keeps the generated notifications, their edits
|
|
411
|
+
* and holds, and the pause state.
|
|
412
|
+
*/
|
|
413
|
+
export type NotificationScheduleDefinition = {
|
|
414
|
+
/**
|
|
415
|
+
* Lowercase letters, digits, and hyphens, for example `'week-one'`. Unique
|
|
416
|
+
* within the type. Moving the file keeps it.
|
|
417
|
+
*/
|
|
418
|
+
key: string;
|
|
419
|
+
name: string;
|
|
420
|
+
/** The type whose folder holds the file. */
|
|
421
|
+
type: NotificationTypeReference;
|
|
422
|
+
/** A template of that type. The template must have an email. */
|
|
423
|
+
template: NotificationTemplateReference;
|
|
424
|
+
/** The resource whose records get the notification, as `Resources.<Name>`. */
|
|
425
|
+
source: { resource: ResourceReference };
|
|
426
|
+
/** The key of a date, datetime, or event schedule field of the source resource. */
|
|
427
|
+
dateField: string;
|
|
428
|
+
/** Defaults to `'day'`. */
|
|
429
|
+
timing?: NotificationScheduleTiming;
|
|
430
|
+
/**
|
|
431
|
+
* One to 30 distinct signed ISO 8601 durations from the date, for example
|
|
432
|
+
* `'-P30D'` (30 days before), `'P0D'` (the day), or `'-PT2H'` (2 hours before).
|
|
433
|
+
*/
|
|
434
|
+
offsets: readonly string[];
|
|
435
|
+
/** Only the source records that match. The same filter object as a `recordEvent` trigger. */
|
|
436
|
+
filters?: StaticValue;
|
|
437
|
+
/**
|
|
438
|
+
* The path of single-record relations from the source record to the type's
|
|
439
|
+
* recipient, for example `'member'` on a `memberships` source. Leave it out
|
|
440
|
+
* when the source resource is the recipient resource.
|
|
441
|
+
*/
|
|
442
|
+
recipient?: string;
|
|
443
|
+
/**
|
|
444
|
+
* A field path on the source record for each variable of the type, for
|
|
445
|
+
* example `'joined_on'` or `'member.name'`. A record variable maps to the id
|
|
446
|
+
* of a record of its resource, for example `'first_event.id'`.
|
|
447
|
+
*/
|
|
448
|
+
variables?: { readonly [key: string]: string };
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
export declare function defineNotificationSchedule<const T extends NotificationScheduleDefinition>(
|
|
452
|
+
schedule: T
|
|
453
|
+
): T;
|
package/dist/index.js
CHANGED
package/dist/sdk-contract.d.ts
CHANGED
|
@@ -1458,6 +1458,28 @@ type TaskNavigateOptions = {
|
|
|
1458
1458
|
preserveState?: boolean;
|
|
1459
1459
|
};
|
|
1460
1460
|
|
|
1461
|
+
type PageRefParams = Record<string, string | number>;
|
|
1462
|
+
|
|
1463
|
+
type PageRef<
|
|
1464
|
+
K extends string = string,
|
|
1465
|
+
P extends PageRefParams | undefined = PageRefParams | undefined
|
|
1466
|
+
> = {
|
|
1467
|
+
/** The page's key, from its `definePage` options. */
|
|
1468
|
+
readonly key: K;
|
|
1469
|
+
/** The page's id, or null when the page is not deployed or is paused. */
|
|
1470
|
+
readonly id: string | null;
|
|
1471
|
+
/** The deployed route pattern, e.g. `/members/{id}`, or null when the page is not deployed or is paused. */
|
|
1472
|
+
readonly route: string | null;
|
|
1473
|
+
/** The page's URL with `params` filled into the route, or null when the page has no route. */
|
|
1474
|
+
url(...args: undefined extends P ? [params?: P] : [params: P]): string | null;
|
|
1475
|
+
/** Navigate to the page with `params` filled into the route. A page without a route is ignored after a warning. */
|
|
1476
|
+
navigate(
|
|
1477
|
+
...args: undefined extends P
|
|
1478
|
+
? [params?: P, options?: TaskNavigateOptions]
|
|
1479
|
+
: [params: P, options?: TaskNavigateOptions]
|
|
1480
|
+
): void;
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1461
1483
|
type SdkResourceReference = SdkResourceHandle | string | null | undefined;
|
|
1462
1484
|
|
|
1463
1485
|
type SdkResourceHandle = Omit<SdkResource, keyof SdkResourceOperations>;
|
|
@@ -13800,6 +13822,8 @@ declare namespace Sdk {
|
|
|
13800
13822
|
export type PageAliasCatalog = import("diagonal:sdk-internal").PageAliasCatalog;
|
|
13801
13823
|
export type PageReference = import("diagonal:sdk-internal").PageReference;
|
|
13802
13824
|
export type PageHandle = import("diagonal:sdk-internal").SdkPageHandle;
|
|
13825
|
+
export type PageRefParams = import("diagonal:sdk-internal").PageRefParams;
|
|
13826
|
+
export type PageRef<K extends string = string, P extends import("diagonal:sdk-internal").PageRefParams | undefined = import("diagonal:sdk-internal").PageRefParams | undefined> = import("diagonal:sdk-internal").PageRef<K, P>;
|
|
13803
13827
|
export type ResourceType<TRecord extends import("diagonal:sdk-internal").ResourceRecord = import("diagonal:sdk-internal").ResourceRecord, TRelations extends import("diagonal:sdk-internal").ResourceRelationCatalog = import("diagonal:sdk-internal").ResourceRelationCatalog> = import("diagonal:sdk-internal").SdkResourceType<TRecord, TRelations>;
|
|
13804
13828
|
export type ResourceRelationsFrom<TResource extends import("diagonal:sdk-internal").SdkResourceType> = import("diagonal:sdk-internal").ResourceRelationsFrom<TResource>;
|
|
13805
13829
|
export type ResourceRelationPath<TResource extends import("diagonal:sdk-internal").SdkResourceType> = import("diagonal:sdk-internal").SdkResourceRelationPath<TResource>;
|