Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(protocol): expose export and collaboration license error codes (#7924)

#FF00004f7bee9c778e
diff --git a/packages/protocol/src/ts/univer/constants/__tests__/errors.spec.ts b/packages/protocol/src/ts/univer/constants/__tests__/errors.spec.ts
new file mode 100644
index 0000000000..fcdf94dfbe
--- /dev/null
+++ b/packages/protocol/src/ts/univer/constants/__tests__/errors.spec.ts
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, expect, it } from 'vitest';
+import { ErrorCode } from '../errors';
+
+describe('Office export error protocol', () => {
+ it.each([
+ ['LICENSE_EXPORT_SIZE_EXCEEDED', 9004],
+ ['LICENSE_EXPORT_QUOTA_EXCEEDED', 9006],
+ ['LICENSE_POLICY_INVALID', 9007],
+ ['LICENSE_USAGE_STATE_INVALID', 9008],
+ ['LICENSE_USAGE_STORAGE_ERROR', 9009],
+ ['LICENSE_CONCURRENCY_TIMEOUT', 9010],
+ ['LICENSE_VERSION_NOT_ALLOWED', 9012],
+ ['LICENSE_NOT_YET_EFFECTIVE', 9013],
+ ['LICENSE_UNIT_TYPE_REJECTED', 9014],
+ ['LICENSE_INVALID', 9015],
+ ['LICENSE_EDITING_CONNECTIONS_EXCEEDED', 9016],
+ ['LICENSE_NODES_EXCEEDED', 9017],
+ ['LICENSE_DOMAIN_REJECTED', 9018],
+ ] as const)('preserves the public wire value %s = %i', (name, code) => {
+ expect(ErrorCode[name]).toBe(code);
+ });
+});
diff --git a/packages/protocol/src/ts/univer/constants/errors.ts b/packages/protocol/src/ts/univer/constants/errors.ts
index eb399433dc..b4fff250b4 100644
--- a/packages/protocol/src/ts/univer/constants/errors.ts
+++ b/packages/protocol/src/ts/univer/constants/errors.ts
@@ -65,6 +65,18 @@ export enum ErrorCode {
LICENSE_EXPORT_SIZE_EXCEEDED = 9004,
/** LICENSE_DISTRO_REJECTED - the feature not allowed for the distro */
LICENSE_DISTRO_REJECTED = 9005,
+ LICENSE_EXPORT_QUOTA_EXCEEDED = 9006,
+ LICENSE_POLICY_INVALID = 9007,
+ LICENSE_USAGE_STATE_INVALID = 9008,
+ LICENSE_USAGE_STORAGE_ERROR = 9009,
+ LICENSE_CONCURRENCY_TIMEOUT = 9010,
+ LICENSE_VERSION_NOT_ALLOWED = 9012,
+ LICENSE_NOT_YET_EFFECTIVE = 9013,
+ LICENSE_UNIT_TYPE_REJECTED = 9014,
+ LICENSE_INVALID = 9015,
+ LICENSE_EDITING_CONNECTIONS_EXCEEDED = 9016,
+ LICENSE_NODES_EXCEEDED = 9017,
+ LICENSE_DOMAIN_REJECTED = 9018,
/** YUUMI_UNABLE_LOAD_URL - yuumi */
YUUMI_UNABLE_LOAD_URL = 10001,
YUUMI_URL_COL_OUT_OF_RANGE = 10002,