zitejs 0.9.128 → 0.9.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/integrations/rules.d.ts +5 -0
- package/dist/cjs/integrations/rules.js +9 -1
- package/dist/cjs/sync/lib.js +4 -1
- package/dist/cjs/sync/lib.test.js +14 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/integrations/rules.d.ts +5 -0
- package/dist/esm/integrations/rules.js +8 -0
- package/dist/esm/sync/lib.js +5 -2
- package/dist/esm/sync/lib.test.js +14 -0
- package/package.json +1 -1
- package/dist/cjs/meta/index.d.ts +0 -14
- package/dist/cjs/meta/index.js +0 -12
- package/dist/cjs/notifications/index.d.ts +0 -25
- package/dist/cjs/notifications/index.js +0 -12
- package/dist/esm/meta/index.d.ts +0 -14
- package/dist/esm/meta/index.js +0 -8
- package/dist/esm/notifications/index.d.ts +0 -25
- package/dist/esm/notifications/index.js +0 -8
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Zite } from "./client/index.js";
|
|
2
2
|
export type { Record, RecordListOutput, RecordListOptions, FieldCreateInput, FieldUpdateInput, TableCreateInput, TableUpdateInput, DatabaseCreateInput, DatabaseListOutput, } from "./client/index.js";
|
|
3
3
|
export * from "./types/index.js";
|
|
4
|
-
export { CREDENTIAL_FIELDS, NON_CREDENTIAL_SERVICE_TYPES, gettableIntegrations, isCredentialServiceType, normalizeIntegrationServiceType, } from "./integrations/rules.js";
|
|
4
|
+
export { CREDENTIAL_FIELDS, NON_CREDENTIAL_SERVICE_TYPES, OPTIONAL_CREDENTIAL_FIELDS, gettableIntegrations, isCredentialServiceType, normalizeIntegrationServiceType, } from "./integrations/rules.js";
|
|
5
5
|
export type { ConfigIntegrations, CredentialServiceType, GettableIntegration, } from "./integrations/rules.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,13 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.normalizeIntegrationServiceType = exports.isCredentialServiceType = exports.gettableIntegrations = exports.NON_CREDENTIAL_SERVICE_TYPES = exports.CREDENTIAL_FIELDS = exports.Zite = void 0;
|
|
17
|
+
exports.normalizeIntegrationServiceType = exports.isCredentialServiceType = exports.gettableIntegrations = exports.OPTIONAL_CREDENTIAL_FIELDS = exports.NON_CREDENTIAL_SERVICE_TYPES = exports.CREDENTIAL_FIELDS = exports.Zite = void 0;
|
|
18
18
|
var index_js_1 = require("./client/index.js");
|
|
19
19
|
Object.defineProperty(exports, "Zite", { enumerable: true, get: function () { return index_js_1.Zite; } });
|
|
20
20
|
__exportStar(require("./types/index.js"), exports);
|
|
21
21
|
var rules_js_1 = require("./integrations/rules.js");
|
|
22
22
|
Object.defineProperty(exports, "CREDENTIAL_FIELDS", { enumerable: true, get: function () { return rules_js_1.CREDENTIAL_FIELDS; } });
|
|
23
23
|
Object.defineProperty(exports, "NON_CREDENTIAL_SERVICE_TYPES", { enumerable: true, get: function () { return rules_js_1.NON_CREDENTIAL_SERVICE_TYPES; } });
|
|
24
|
+
Object.defineProperty(exports, "OPTIONAL_CREDENTIAL_FIELDS", { enumerable: true, get: function () { return rules_js_1.OPTIONAL_CREDENTIAL_FIELDS; } });
|
|
24
25
|
Object.defineProperty(exports, "gettableIntegrations", { enumerable: true, get: function () { return rules_js_1.gettableIntegrations; } });
|
|
25
26
|
Object.defineProperty(exports, "isCredentialServiceType", { enumerable: true, get: function () { return rules_js_1.isCredentialServiceType; } });
|
|
26
27
|
Object.defineProperty(exports, "normalizeIntegrationServiceType", { enumerable: true, get: function () { return rules_js_1.normalizeIntegrationServiceType; } });
|
|
@@ -45,6 +45,11 @@ declare const FIELDS_BY_TYPE: {
|
|
|
45
45
|
export type CredentialServiceType = keyof typeof FIELDS_BY_TYPE;
|
|
46
46
|
/** Per service type: `accessToken`, then its extra labels sorted (Salesforce `instanceUrl`). */
|
|
47
47
|
export declare const CREDENTIAL_FIELDS: Readonly<Record<CredentialServiceType, readonly string[]>>;
|
|
48
|
+
/**
|
|
49
|
+
* Extras the platform omits when the account doesn't have them: a Jira site
|
|
50
|
+
* connected before its URL was stored, a Trello key the deployment never set.
|
|
51
|
+
*/
|
|
52
|
+
export declare const OPTIONAL_CREDENTIAL_FIELDS: Readonly<Partial<Record<CredentialServiceType, readonly string[]>>>;
|
|
48
53
|
/**
|
|
49
54
|
* Types the runtime never serves: those with a generated client (Airtable, email,
|
|
50
55
|
* the project database, Fillout) and those whose key is a frontend value (Maps, Analytics).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Which `zite.config.json` entries `integrations.get` can name, and the fields
|
|
3
3
|
// each answers with. No imports, so the platform applies these same rules.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.gettableIntegrations = exports.isCredentialServiceType = exports.normalizeIntegrationServiceType = exports.NON_CREDENTIAL_SERVICE_TYPES = exports.CREDENTIAL_FIELDS = void 0;
|
|
5
|
+
exports.gettableIntegrations = exports.isCredentialServiceType = exports.normalizeIntegrationServiceType = exports.NON_CREDENTIAL_SERVICE_TYPES = exports.OPTIONAL_CREDENTIAL_FIELDS = exports.CREDENTIAL_FIELDS = void 0;
|
|
6
6
|
const extras = (...labels) => [
|
|
7
7
|
"accessToken",
|
|
8
8
|
...[...labels].sort(),
|
|
@@ -52,6 +52,14 @@ const FIELDS_BY_TYPE = {
|
|
|
52
52
|
};
|
|
53
53
|
/** Per service type: `accessToken`, then its extra labels sorted (Salesforce `instanceUrl`). */
|
|
54
54
|
exports.CREDENTIAL_FIELDS = FIELDS_BY_TYPE;
|
|
55
|
+
/**
|
|
56
|
+
* Extras the platform omits when the account doesn't have them: a Jira site
|
|
57
|
+
* connected before its URL was stored, a Trello key the deployment never set.
|
|
58
|
+
*/
|
|
59
|
+
exports.OPTIONAL_CREDENTIAL_FIELDS = {
|
|
60
|
+
jira: ["siteUrl"],
|
|
61
|
+
trello: ["clientApiKey"],
|
|
62
|
+
};
|
|
55
63
|
/**
|
|
56
64
|
* Types the runtime never serves: those with a generated client (Airtable, email,
|
|
57
65
|
* the project database, Fillout) and those whose key is a frontend value (Maps, Analytics).
|
package/dist/cjs/sync/lib.js
CHANGED
|
@@ -1406,9 +1406,12 @@ function generateEmailSdk(integrationId) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
const connectedTypeFor = (serviceType) => {
|
|
1408
1408
|
const extraLabels = rules_js_1.CREDENTIAL_FIELDS[serviceType].slice(1);
|
|
1409
|
+
const optional = rules_js_1.OPTIONAL_CREDENTIAL_FIELDS[serviceType] ?? [];
|
|
1409
1410
|
return extraLabels.length === 0
|
|
1410
1411
|
? "Connected"
|
|
1411
|
-
: `Connected<{ ${extraLabels
|
|
1412
|
+
: `Connected<{ ${extraLabels
|
|
1413
|
+
.map((label) => `${label}${optional.includes(label) ? "?" : ""}: string`)
|
|
1414
|
+
.join("; ")} }>`;
|
|
1412
1415
|
};
|
|
1413
1416
|
/**
|
|
1414
1417
|
* `.zite/integrations/index.ts`: `zitejs/integrations` for one source dir. The
|
|
@@ -498,6 +498,20 @@ const duplicateIdentifierErrorsIn = (source) => {
|
|
|
498
498
|
"
|
|
499
499
|
`);
|
|
500
500
|
});
|
|
501
|
+
// The platform leaves these out for some accounts, so the type can't promise them.
|
|
502
|
+
(0, vitest_1.it)('marks an extra the platform may omit as optional', () => {
|
|
503
|
+
const generated = (0, lib_js_1.generateIntegrationsIndex)([{ name: 'tickets', serviceType: 'jira' }], { reexportAirtable: false });
|
|
504
|
+
(0, vitest_1.expect)(generated).toContain("'tickets': Connected<{ cloudId: string; siteUrl?: string }> | NeedsConnect;");
|
|
505
|
+
(0, vitest_1.expect)(typeErrorsIn(generated, `import { integrations } from 'zitejs/integrations';
|
|
506
|
+
const jira = await integrations.get('tickets');
|
|
507
|
+
if (jira.status === 'connected') {
|
|
508
|
+
const cloudId: string = jira.cloudId;
|
|
509
|
+
const siteUrl: string = jira.siteUrl;
|
|
510
|
+
}
|
|
511
|
+
`)).toEqual([
|
|
512
|
+
vitest_1.expect.stringContaining("Type 'string | undefined' is not assignable"),
|
|
513
|
+
]);
|
|
514
|
+
});
|
|
501
515
|
(0, vitest_1.it)('types get per name in app code', () => {
|
|
502
516
|
const generated = (0, lib_js_1.generateIntegrationsIndex)([
|
|
503
517
|
{ name: 'crm', serviceType: 'salesforce' },
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Zite } from "./client/index.js";
|
|
2
2
|
export type { Record, RecordListOutput, RecordListOptions, FieldCreateInput, FieldUpdateInput, TableCreateInput, TableUpdateInput, DatabaseCreateInput, DatabaseListOutput, } from "./client/index.js";
|
|
3
3
|
export * from "./types/index.js";
|
|
4
|
-
export { CREDENTIAL_FIELDS, NON_CREDENTIAL_SERVICE_TYPES, gettableIntegrations, isCredentialServiceType, normalizeIntegrationServiceType, } from "./integrations/rules.js";
|
|
4
|
+
export { CREDENTIAL_FIELDS, NON_CREDENTIAL_SERVICE_TYPES, OPTIONAL_CREDENTIAL_FIELDS, gettableIntegrations, isCredentialServiceType, normalizeIntegrationServiceType, } from "./integrations/rules.js";
|
|
5
5
|
export type { ConfigIntegrations, CredentialServiceType, GettableIntegration, } from "./integrations/rules.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Zite } from "./client/index.js";
|
|
2
2
|
export * from "./types/index.js";
|
|
3
|
-
export { CREDENTIAL_FIELDS, NON_CREDENTIAL_SERVICE_TYPES, gettableIntegrations, isCredentialServiceType, normalizeIntegrationServiceType, } from "./integrations/rules.js";
|
|
3
|
+
export { CREDENTIAL_FIELDS, NON_CREDENTIAL_SERVICE_TYPES, OPTIONAL_CREDENTIAL_FIELDS, gettableIntegrations, isCredentialServiceType, normalizeIntegrationServiceType, } from "./integrations/rules.js";
|
|
@@ -45,6 +45,11 @@ declare const FIELDS_BY_TYPE: {
|
|
|
45
45
|
export type CredentialServiceType = keyof typeof FIELDS_BY_TYPE;
|
|
46
46
|
/** Per service type: `accessToken`, then its extra labels sorted (Salesforce `instanceUrl`). */
|
|
47
47
|
export declare const CREDENTIAL_FIELDS: Readonly<Record<CredentialServiceType, readonly string[]>>;
|
|
48
|
+
/**
|
|
49
|
+
* Extras the platform omits when the account doesn't have them: a Jira site
|
|
50
|
+
* connected before its URL was stored, a Trello key the deployment never set.
|
|
51
|
+
*/
|
|
52
|
+
export declare const OPTIONAL_CREDENTIAL_FIELDS: Readonly<Partial<Record<CredentialServiceType, readonly string[]>>>;
|
|
48
53
|
/**
|
|
49
54
|
* Types the runtime never serves: those with a generated client (Airtable, email,
|
|
50
55
|
* the project database, Fillout) and those whose key is a frontend value (Maps, Analytics).
|
|
@@ -49,6 +49,14 @@ const FIELDS_BY_TYPE = {
|
|
|
49
49
|
};
|
|
50
50
|
/** Per service type: `accessToken`, then its extra labels sorted (Salesforce `instanceUrl`). */
|
|
51
51
|
export const CREDENTIAL_FIELDS = FIELDS_BY_TYPE;
|
|
52
|
+
/**
|
|
53
|
+
* Extras the platform omits when the account doesn't have them: a Jira site
|
|
54
|
+
* connected before its URL was stored, a Trello key the deployment never set.
|
|
55
|
+
*/
|
|
56
|
+
export const OPTIONAL_CREDENTIAL_FIELDS = {
|
|
57
|
+
jira: ["siteUrl"],
|
|
58
|
+
trello: ["clientApiKey"],
|
|
59
|
+
};
|
|
52
60
|
/**
|
|
53
61
|
* Types the runtime never serves: those with a generated client (Airtable, email,
|
|
54
62
|
* the project database, Fillout) and those whose key is a frontend value (Maps, Analytics).
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse } from "@babel/parser";
|
|
2
2
|
import { allocateSchemaNames, describeRenames, keepValidSdkName, normalizeSchemaNames, SdkNameAllocator, toCamelCase, toPascalCase, toSdkName, } from "./sdkNames.js";
|
|
3
|
-
import { CREDENTIAL_FIELDS, } from "../integrations/rules.js";
|
|
3
|
+
import { CREDENTIAL_FIELDS, OPTIONAL_CREDENTIAL_FIELDS, } from "../integrations/rules.js";
|
|
4
4
|
const AUTH_USERS_TABLE_ID = "zite_user";
|
|
5
5
|
/**
|
|
6
6
|
* What a field's value looks like when a record is READ back.
|
|
@@ -1391,9 +1391,12 @@ export function generateEmailSdk(integrationId) {
|
|
|
1391
1391
|
}
|
|
1392
1392
|
const connectedTypeFor = (serviceType) => {
|
|
1393
1393
|
const extraLabels = CREDENTIAL_FIELDS[serviceType].slice(1);
|
|
1394
|
+
const optional = OPTIONAL_CREDENTIAL_FIELDS[serviceType] ?? [];
|
|
1394
1395
|
return extraLabels.length === 0
|
|
1395
1396
|
? "Connected"
|
|
1396
|
-
: `Connected<{ ${extraLabels
|
|
1397
|
+
: `Connected<{ ${extraLabels
|
|
1398
|
+
.map((label) => `${label}${optional.includes(label) ? "?" : ""}: string`)
|
|
1399
|
+
.join("; ")} }>`;
|
|
1397
1400
|
};
|
|
1398
1401
|
/**
|
|
1399
1402
|
* `.zite/integrations/index.ts`: `zitejs/integrations` for one source dir. The
|
|
@@ -493,6 +493,20 @@ describe('generateIntegrationsIndex', () => {
|
|
|
493
493
|
"
|
|
494
494
|
`);
|
|
495
495
|
});
|
|
496
|
+
// The platform leaves these out for some accounts, so the type can't promise them.
|
|
497
|
+
it('marks an extra the platform may omit as optional', () => {
|
|
498
|
+
const generated = generateIntegrationsIndex([{ name: 'tickets', serviceType: 'jira' }], { reexportAirtable: false });
|
|
499
|
+
expect(generated).toContain("'tickets': Connected<{ cloudId: string; siteUrl?: string }> | NeedsConnect;");
|
|
500
|
+
expect(typeErrorsIn(generated, `import { integrations } from 'zitejs/integrations';
|
|
501
|
+
const jira = await integrations.get('tickets');
|
|
502
|
+
if (jira.status === 'connected') {
|
|
503
|
+
const cloudId: string = jira.cloudId;
|
|
504
|
+
const siteUrl: string = jira.siteUrl;
|
|
505
|
+
}
|
|
506
|
+
`)).toEqual([
|
|
507
|
+
expect.stringContaining("Type 'string | undefined' is not assignable"),
|
|
508
|
+
]);
|
|
509
|
+
});
|
|
496
510
|
it('types get per name in app code', () => {
|
|
497
511
|
const generated = generateIntegrationsIndex([
|
|
498
512
|
{ name: 'crm', serviceType: 'salesforce' },
|
package/package.json
CHANGED
package/dist/cjs/meta/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type ZiteProjectUser = {
|
|
2
|
-
uuid: string;
|
|
3
|
-
firstName: string | null;
|
|
4
|
-
lastName: string | null;
|
|
5
|
-
email: string;
|
|
6
|
-
profilePictureUrl: string | null;
|
|
7
|
-
};
|
|
8
|
-
export type MetaListUsersResult = {
|
|
9
|
-
users: ZiteProjectUser[];
|
|
10
|
-
};
|
|
11
|
-
export declare class ZiteMeta {
|
|
12
|
-
static listUsers(): Promise<MetaListUsersResult>;
|
|
13
|
-
}
|
|
14
|
-
export declare const Meta: typeof ZiteMeta;
|
package/dist/cjs/meta/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Meta = exports.ZiteMeta = void 0;
|
|
4
|
-
const sdkCall_js_1 = require("../internal/sdkCall.js");
|
|
5
|
-
const META_SDK_INTEGRATION_ID = '__meta__';
|
|
6
|
-
class ZiteMeta {
|
|
7
|
-
static listUsers() {
|
|
8
|
-
return (0, sdkCall_js_1.getSdkCall)()(META_SDK_INTEGRATION_ID, 'ZiteMeta', 'listUsers', {});
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.ZiteMeta = ZiteMeta;
|
|
12
|
-
exports.Meta = ZiteMeta;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface NotificationLink {
|
|
2
|
-
path?: string;
|
|
3
|
-
params?: Record<string, string>;
|
|
4
|
-
}
|
|
5
|
-
export type NotificationsCreateParams = {
|
|
6
|
-
recipients: string[];
|
|
7
|
-
title: string;
|
|
8
|
-
body?: string;
|
|
9
|
-
link?: NotificationLink;
|
|
10
|
-
path?: string;
|
|
11
|
-
params?: Record<string, string>;
|
|
12
|
-
payload?: Record<string, unknown>;
|
|
13
|
-
idempotencyKey?: string;
|
|
14
|
-
};
|
|
15
|
-
export type NotificationsCreateResult = {
|
|
16
|
-
created: number;
|
|
17
|
-
} | {
|
|
18
|
-
created: 0;
|
|
19
|
-
preview: true;
|
|
20
|
-
wouldCreate: number;
|
|
21
|
-
};
|
|
22
|
-
export declare class ZiteNotifications {
|
|
23
|
-
static create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
|
|
24
|
-
}
|
|
25
|
-
export declare const Notifications: typeof ZiteNotifications;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Notifications = exports.ZiteNotifications = void 0;
|
|
4
|
-
const sdkCall_js_1 = require("../internal/sdkCall.js");
|
|
5
|
-
const NOTIFICATIONS_SDK_INTEGRATION_ID = '__notifications__';
|
|
6
|
-
class ZiteNotifications {
|
|
7
|
-
static create(params) {
|
|
8
|
-
return (0, sdkCall_js_1.getSdkCall)()(NOTIFICATIONS_SDK_INTEGRATION_ID, 'ZiteNotifications', 'create', params);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.ZiteNotifications = ZiteNotifications;
|
|
12
|
-
exports.Notifications = ZiteNotifications;
|
package/dist/esm/meta/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type ZiteProjectUser = {
|
|
2
|
-
uuid: string;
|
|
3
|
-
firstName: string | null;
|
|
4
|
-
lastName: string | null;
|
|
5
|
-
email: string;
|
|
6
|
-
profilePictureUrl: string | null;
|
|
7
|
-
};
|
|
8
|
-
export type MetaListUsersResult = {
|
|
9
|
-
users: ZiteProjectUser[];
|
|
10
|
-
};
|
|
11
|
-
export declare class ZiteMeta {
|
|
12
|
-
static listUsers(): Promise<MetaListUsersResult>;
|
|
13
|
-
}
|
|
14
|
-
export declare const Meta: typeof ZiteMeta;
|
package/dist/esm/meta/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface NotificationLink {
|
|
2
|
-
path?: string;
|
|
3
|
-
params?: Record<string, string>;
|
|
4
|
-
}
|
|
5
|
-
export type NotificationsCreateParams = {
|
|
6
|
-
recipients: string[];
|
|
7
|
-
title: string;
|
|
8
|
-
body?: string;
|
|
9
|
-
link?: NotificationLink;
|
|
10
|
-
path?: string;
|
|
11
|
-
params?: Record<string, string>;
|
|
12
|
-
payload?: Record<string, unknown>;
|
|
13
|
-
idempotencyKey?: string;
|
|
14
|
-
};
|
|
15
|
-
export type NotificationsCreateResult = {
|
|
16
|
-
created: number;
|
|
17
|
-
} | {
|
|
18
|
-
created: 0;
|
|
19
|
-
preview: true;
|
|
20
|
-
wouldCreate: number;
|
|
21
|
-
};
|
|
22
|
-
export declare class ZiteNotifications {
|
|
23
|
-
static create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
|
|
24
|
-
}
|
|
25
|
-
export declare const Notifications: typeof ZiteNotifications;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { getSdkCall } from '../internal/sdkCall.js';
|
|
2
|
-
const NOTIFICATIONS_SDK_INTEGRATION_ID = '__notifications__';
|
|
3
|
-
export class ZiteNotifications {
|
|
4
|
-
static create(params) {
|
|
5
|
-
return getSdkCall()(NOTIFICATIONS_SDK_INTEGRATION_ID, 'ZiteNotifications', 'create', params);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export const Notifications = ZiteNotifications;
|