lucid-extension-sdk 0.0.76 → 0.0.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -893,6 +893,8 @@ export declare type ReloadExtensionResult = undefined;
893
893
  export declare type SendOAuthRequestQuery = SendXHRQuery & {
894
894
  /** OAuth provider name as specified in the package manifest */
895
895
  'p': string;
896
+ /** Post Result To */
897
+ 'prt'?: string;
896
898
  };
897
899
  export declare type SendPermanentTokenRequestQuery = SendXHRQuery & {
898
900
  /** Permanent token provider name as specified in the package manifest */
@@ -14,6 +14,9 @@ export declare type SerializedFields = {
14
14
  export declare type SerializedLucidDateObject = {
15
15
  'ms': number;
16
16
  'isDateOnly'?: boolean;
17
+ } | {
18
+ 'isoDate': string;
19
+ 'displayTimezone'?: string;
17
20
  };
18
21
  export declare type SerializedRGBColor = {
19
22
  'r': number;
@@ -15,8 +15,10 @@ function isSerializedLucidCurrency(value) {
15
15
  }
16
16
  exports.isSerializedLucidCurrency = isSerializedLucidCurrency;
17
17
  function isSerializedLucidDateObject(value) {
18
- var _a;
19
- return (0, checks_1.isObject)(value) && (0, checks_1.isNumber)(value['ms']) && (0, checks_1.isBoolean)((_a = value['isDateOnly']) !== null && _a !== void 0 ? _a : true);
18
+ var _a, _b;
19
+ return ((0, checks_1.isObject)(value) &&
20
+ (((0, checks_1.isNumber)(value['ms']) && (0, checks_1.isBoolean)((_a = value['isDateOnly']) !== null && _a !== void 0 ? _a : true)) ||
21
+ ((0, checks_1.isString)(value['isoDate']) && (0, checks_1.isString)((_b = value['displayTimezone']) !== null && _b !== void 0 ? _b : 'a'))));
20
22
  }
21
23
  exports.isSerializedLucidDateObject = isSerializedLucidDateObject;
22
24
  function isSerializedFieldType(value) {
package/sdk/core/xhr.d.ts CHANGED
@@ -21,6 +21,16 @@ export interface XHRRequest {
21
21
  */
22
22
  responseFormat?: SendXHRResponseFormat;
23
23
  }
24
+ export interface OAuthXHRRequest extends XHRRequest {
25
+ /**
26
+ * When present, forwards the result of this request to the specified destination. Instead, this request returns
27
+ * whether the request will be made and forwarded, and not the actual request.
28
+ *
29
+ * Note: There is an allow list which limits where the result can be posted. It is currently only to the result of
30
+ * ExperimentalLinkUnfurlBlockProxy#experimentalStartPDFUpload
31
+ */
32
+ postResultTo?: string;
33
+ }
24
34
  export interface BaseXHRResponse {
25
35
  /** URL of the final response, after any redirects */
26
36
  url: string;
@@ -49,19 +49,6 @@ export declare class ExperimentalLinkUnfurlBlockProxy extends BlockProxy {
49
49
  * @ignore
50
50
  * Initiates the PDF upload for this block. The result includes an uploadUrl which you can use to upload the PDF.
51
51
  * The PDF uploaded at that url will be assocaite with this block (and any copy of it) in the editor until it is refreshed.
52
- * @param options The options for the upload
53
52
  */
54
- experimentalStartPDFUpload(options: LinkUnfurlPDFOptions): Promise<StartPDFUploadRequestResponse>;
55
- }
56
- /**
57
- * @ignore
58
- * Options for starting the PDF upload process for a link unfurl
59
- */
60
- export interface LinkUnfurlPDFOptions {
61
- /**
62
- * @ignore
63
- * The anticipated number of pages. If this is defined, this is the number of pages that will show up while the PDF
64
- * is being processed and converted into images. Once converted, the actual number will take precedence.
65
- */
66
- expectedNumberOfPages: number;
53
+ experimentalStartPDFUpload(): Promise<StartPDFUploadRequestResponse>;
67
54
  }
@@ -66,9 +66,8 @@ class ExperimentalLinkUnfurlBlockProxy extends blockproxy_1.BlockProxy {
66
66
  * @ignore
67
67
  * Initiates the PDF upload for this block. The result includes an uploadUrl which you can use to upload the PDF.
68
68
  * The PDF uploaded at that url will be assocaite with this block (and any copy of it) in the editor until it is refreshed.
69
- * @param options The options for the upload
70
69
  */
71
- async experimentalStartPDFUpload(options) {
70
+ async experimentalStartPDFUpload() {
72
71
  const result = await this.client.sendCommand("pdf" /* CommandName.StartPDFUploadRequest */, this.id);
73
72
  return result;
74
73
  }
@@ -1,7 +1,7 @@
1
1
  import { CommandArgs, CommandName, UnionToIntersection } from './commandtypes';
2
2
  import { JsonSerializable } from './core/jsonserializable';
3
3
  import { UnfurlCallbacks } from './core/unfurl/unfurlcallbacks';
4
- import { BinaryXHRResponse, TextXHRResponse, XHRRequest, XHRResponse } from './core/xhr';
4
+ import { BinaryXHRResponse, OAuthXHRRequest, TextXHRResponse, XHRRequest, XHRResponse } from './core/xhr';
5
5
  import { CollectionProxy } from './data/collectionproxy';
6
6
  import { BlockDefinition } from './document/blockdefinition';
7
7
  import { BlockProxy } from './document/blockproxy';
@@ -75,13 +75,13 @@ export declare class EditorClient {
75
75
  responseFormat: 'binary';
76
76
  }): Promise<BinaryXHRResponse>;
77
77
  xhr(request: XHRRequest): Promise<XHRResponse>;
78
- oauthXhr(providerName: string, request: XHRRequest & {
78
+ oauthXhr(providerName: string, request: OAuthXHRRequest & {
79
79
  responseFormat: 'utf8';
80
80
  }): Promise<TextXHRResponse>;
81
- oauthXhr(providerName: string, request: XHRRequest & {
81
+ oauthXhr(providerName: string, request: OAuthXHRRequest & {
82
82
  responseFormat: 'binary';
83
83
  }): Promise<BinaryXHRResponse>;
84
- oauthXhr(providerName: string, request: XHRRequest): Promise<XHRResponse>;
84
+ oauthXhr(providerName: string, request: OAuthXHRRequest): Promise<XHRResponse>;
85
85
  /**
86
86
  * Make a request with a permanent token like a merge account token or API key.
87
87
  * @param providerName The name of the authorization provider from the manifest
@@ -142,15 +142,7 @@ class EditorClient {
142
142
  }
143
143
  oauthXhr(providerName, request) {
144
144
  const responseFormat = request.responseFormat || 'utf8';
145
- return this.sendCommand("oauth" /* CommandName.SendOAuthRequest */, {
146
- 'url': request.url,
147
- 'm': request.method,
148
- 'd': request.data,
149
- 'h': request.headers,
150
- 'ms': request.timeoutMs,
151
- 'p': providerName,
152
- 'f': responseFormat,
153
- })
145
+ return this.sendCommand("oauth" /* CommandName.SendOAuthRequest */, Object.assign({ 'url': request.url, 'm': request.method, 'd': request.data, 'h': request.headers, 'ms': request.timeoutMs, 'p': providerName, 'f': responseFormat }, (request.postResultTo ? { 'prt': request.postResultTo } : {})))
154
146
  .then((raw) => {
155
147
  return parseRawXHRResponse(responseFormat, raw);
156
148
  })