plugin-document-understanding 1.1.13 → 1.1.15

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.
Files changed (128) hide show
  1. package/README.md +29 -29
  2. package/client-v2.d.ts +2 -2
  3. package/client-v2.js +1 -1
  4. package/dist/client-v2/index.js +1 -1
  5. package/dist/externalVersion.js +8 -7
  6. package/dist/locale/en-US.json +3 -1
  7. package/dist/locale/zh-CN.json +3 -1
  8. package/dist/node_modules/form-data/lib/form_data.js +2 -2
  9. package/dist/node_modules/form-data/node_modules/es-define-property/.eslintrc +13 -0
  10. package/dist/node_modules/form-data/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  11. package/dist/node_modules/form-data/node_modules/es-define-property/.nycrc +9 -0
  12. package/dist/node_modules/form-data/node_modules/es-define-property/index.d.ts +3 -0
  13. package/dist/node_modules/form-data/node_modules/es-define-property/index.js +14 -0
  14. package/dist/node_modules/form-data/node_modules/es-define-property/package.json +81 -0
  15. package/dist/node_modules/form-data/node_modules/es-define-property/test/index.js +56 -0
  16. package/dist/node_modules/form-data/node_modules/es-object-atoms/.eslintrc +16 -0
  17. package/dist/node_modules/form-data/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  18. package/dist/node_modules/form-data/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  19. package/dist/node_modules/form-data/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  20. package/dist/node_modules/form-data/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  21. package/dist/node_modules/form-data/node_modules/es-object-atoms/ToObject.js +10 -0
  22. package/dist/node_modules/form-data/node_modules/es-object-atoms/index.d.ts +3 -0
  23. package/dist/node_modules/form-data/node_modules/es-object-atoms/index.js +4 -0
  24. package/dist/node_modules/form-data/node_modules/es-object-atoms/isObject.d.ts +3 -0
  25. package/dist/node_modules/form-data/node_modules/es-object-atoms/isObject.js +6 -0
  26. package/dist/node_modules/form-data/node_modules/es-object-atoms/package.json +80 -0
  27. package/dist/node_modules/form-data/node_modules/es-object-atoms/test/index.js +38 -0
  28. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/.eslintrc +13 -0
  29. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/.nycrc +9 -0
  30. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/index.d.ts +10 -0
  31. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/index.js +35 -0
  32. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/node_modules/hasown/.eslintrc +5 -0
  33. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/node_modules/hasown/.github/FUNDING.yml +12 -0
  34. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/node_modules/hasown/.nycrc +13 -0
  35. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/node_modules/hasown/index.d.ts +3 -0
  36. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/node_modules/hasown/index.js +8 -0
  37. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/node_modules/hasown/package.json +92 -0
  38. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/package.json +78 -0
  39. package/dist/node_modules/form-data/node_modules/es-set-tostringtag/test/index.js +85 -0
  40. package/dist/node_modules/form-data/node_modules/get-intrinsic/.eslintrc +42 -0
  41. package/dist/node_modules/form-data/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  42. package/dist/node_modules/form-data/node_modules/get-intrinsic/.nycrc +9 -0
  43. package/dist/node_modules/form-data/node_modules/get-intrinsic/index.js +378 -0
  44. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/.eslintrc +11 -0
  45. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  46. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/.nycrc +9 -0
  47. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/index.d.ts +3 -0
  48. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/index.js +14 -0
  49. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/package.json +111 -0
  50. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/shams.d.ts +3 -0
  51. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/shams.js +45 -0
  52. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/test/index.js +22 -0
  53. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/test/shams/core-js.js +29 -0
  54. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  55. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/has-symbols/test/tests.js +58 -0
  56. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/hasown/.eslintrc +5 -0
  57. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/hasown/.github/FUNDING.yml +12 -0
  58. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/hasown/.nycrc +13 -0
  59. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/hasown/index.d.ts +3 -0
  60. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/hasown/index.js +8 -0
  61. package/dist/node_modules/form-data/node_modules/get-intrinsic/node_modules/hasown/package.json +92 -0
  62. package/dist/node_modules/form-data/node_modules/get-intrinsic/package.json +97 -0
  63. package/dist/node_modules/form-data/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  64. package/dist/node_modules/form-data/node_modules/gopd/.eslintrc +16 -0
  65. package/dist/node_modules/form-data/node_modules/gopd/.github/FUNDING.yml +12 -0
  66. package/dist/node_modules/form-data/node_modules/gopd/gOPD.d.ts +1 -0
  67. package/dist/node_modules/form-data/node_modules/gopd/gOPD.js +4 -0
  68. package/dist/node_modules/form-data/node_modules/gopd/index.d.ts +5 -0
  69. package/dist/node_modules/form-data/node_modules/gopd/index.js +15 -0
  70. package/dist/node_modules/form-data/node_modules/gopd/package.json +77 -0
  71. package/dist/node_modules/form-data/node_modules/gopd/test/index.js +36 -0
  72. package/dist/node_modules/form-data/node_modules/has-tostringtag/.eslintrc +5 -0
  73. package/dist/node_modules/form-data/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  74. package/dist/node_modules/form-data/node_modules/has-tostringtag/.nycrc +13 -0
  75. package/dist/node_modules/form-data/node_modules/has-tostringtag/index.d.ts +3 -0
  76. package/dist/node_modules/form-data/node_modules/has-tostringtag/index.js +8 -0
  77. package/dist/node_modules/form-data/node_modules/has-tostringtag/package.json +108 -0
  78. package/dist/node_modules/form-data/node_modules/has-tostringtag/shams.d.ts +3 -0
  79. package/dist/node_modules/form-data/node_modules/has-tostringtag/shams.js +8 -0
  80. package/dist/node_modules/form-data/node_modules/has-tostringtag/test/index.js +21 -0
  81. package/dist/node_modules/form-data/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  82. package/dist/node_modules/form-data/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  83. package/dist/node_modules/form-data/node_modules/has-tostringtag/test/tests.js +15 -0
  84. package/dist/node_modules/form-data/node_modules/hasown/.github/FUNDING.yml +12 -0
  85. package/dist/node_modules/form-data/node_modules/hasown/.nycrc +13 -0
  86. package/dist/node_modules/form-data/node_modules/hasown/index.d.ts +3 -0
  87. package/dist/node_modules/form-data/node_modules/hasown/index.js +8 -0
  88. package/dist/node_modules/form-data/node_modules/hasown/package.json +91 -0
  89. package/dist/node_modules/form-data/package.json +1 -1
  90. package/dist/node_modules/mime-types/index.js +3 -3
  91. package/dist/node_modules/mime-types/package.json +1 -1
  92. package/dist/server/actions.js +45 -35
  93. package/package.json +57 -46
  94. package/src/client/index.tsx +15 -15
  95. package/src/client-v2/components/EndpointsTab.tsx +578 -578
  96. package/src/client-v2/components/JobsTab.tsx +294 -294
  97. package/src/client-v2/components/PipelinesTab.tsx +962 -962
  98. package/src/client-v2/components/PluginSettings.tsx +50 -50
  99. package/src/client-v2/components/ServiceConfigTab.tsx +139 -139
  100. package/src/client-v2/index.tsx +1 -1
  101. package/src/client-v2/locale.ts +21 -21
  102. package/src/client-v2/models/index.ts +12 -12
  103. package/src/client-v2/plugin.tsx +31 -21
  104. package/src/client-v2/types.ts +32 -32
  105. package/src/index.ts +2 -2
  106. package/src/locale/en-US.json +3 -1
  107. package/src/locale/zh-CN.json +3 -1
  108. package/src/server/__tests__/actions.test.ts +121 -98
  109. package/src/server/__tests__/cluster-safety.test.ts +259 -259
  110. package/src/server/__tests__/document-understanding-service.test.ts +82 -82
  111. package/src/server/__tests__/dugate-integration.test.ts +221 -221
  112. package/src/server/__tests__/smoke.test.ts +78 -55
  113. package/src/server/__tests__/upload-security.test.ts +128 -0
  114. package/src/server/actions.ts +53 -51
  115. package/src/server/collections/config.ts +18 -18
  116. package/src/server/collections/endpoints.ts +33 -33
  117. package/src/server/collections/jobs.ts +42 -42
  118. package/src/server/collections/pipeline-steps.ts +27 -27
  119. package/src/server/collections/pipelines.ts +19 -19
  120. package/src/server/dugate-seed.ts +491 -491
  121. package/src/server/index.ts +1 -1
  122. package/src/server/plugin.ts +143 -143
  123. package/src/server/services/AsyncJobManager.ts +238 -238
  124. package/src/server/services/DocumentUnderstandingService.ts +332 -332
  125. package/src/server/services/ExternalApiClient.ts +178 -178
  126. package/src/server/services/PipelineExecutor.ts +593 -593
  127. package/src/server/tools/document-understanding-tool.ts +181 -181
  128. package/src/server/types.ts +90 -90
@@ -0,0 +1,274 @@
1
+ 'use strict';
2
+
3
+ var GetIntrinsic = require('../');
4
+
5
+ var test = require('tape');
6
+ var forEach = require('for-each');
7
+ var debug = require('object-inspect');
8
+ var generatorFns = require('make-generator-function')();
9
+ var asyncFns = require('make-async-function').list();
10
+ var asyncGenFns = require('make-async-generator-function')();
11
+ var mockProperty = require('mock-property');
12
+
13
+ var callBound = require('call-bound');
14
+ var v = require('es-value-fixtures');
15
+ var $gOPD = require('gopd');
16
+ var DefinePropertyOrThrow = require('es-abstract/2023/DefinePropertyOrThrow');
17
+
18
+ var $isProto = callBound('%Object.prototype.isPrototypeOf%');
19
+
20
+ test('export', function (t) {
21
+ t.equal(typeof GetIntrinsic, 'function', 'it is a function');
22
+ t.equal(GetIntrinsic.length, 2, 'function has length of 2');
23
+
24
+ t.end();
25
+ });
26
+
27
+ test('throws', function (t) {
28
+ t['throws'](
29
+ function () { GetIntrinsic('not an intrinsic'); },
30
+ SyntaxError,
31
+ 'nonexistent intrinsic throws a syntax error'
32
+ );
33
+
34
+ t['throws'](
35
+ function () { GetIntrinsic(''); },
36
+ TypeError,
37
+ 'empty string intrinsic throws a type error'
38
+ );
39
+
40
+ t['throws'](
41
+ function () { GetIntrinsic('.'); },
42
+ SyntaxError,
43
+ '"just a dot" intrinsic throws a syntax error'
44
+ );
45
+
46
+ t['throws'](
47
+ function () { GetIntrinsic('%String'); },
48
+ SyntaxError,
49
+ 'Leading % without trailing % throws a syntax error'
50
+ );
51
+
52
+ t['throws'](
53
+ function () { GetIntrinsic('String%'); },
54
+ SyntaxError,
55
+ 'Trailing % without leading % throws a syntax error'
56
+ );
57
+
58
+ t['throws'](
59
+ function () { GetIntrinsic("String['prototype]"); },
60
+ SyntaxError,
61
+ 'Dynamic property access is disallowed for intrinsics (unterminated string)'
62
+ );
63
+
64
+ t['throws'](
65
+ function () { GetIntrinsic('%Proxy.prototype.undefined%'); },
66
+ TypeError,
67
+ "Throws when middle part doesn't exist (%Proxy.prototype.undefined%)"
68
+ );
69
+
70
+ t['throws'](
71
+ function () { GetIntrinsic('%Array.prototype%garbage%'); },
72
+ SyntaxError,
73
+ 'Throws with extra percent signs'
74
+ );
75
+
76
+ t['throws'](
77
+ function () { GetIntrinsic('%Array.prototype%push%'); },
78
+ SyntaxError,
79
+ 'Throws with extra percent signs, even on an existing intrinsic'
80
+ );
81
+
82
+ forEach(v.nonStrings, function (nonString) {
83
+ t['throws'](
84
+ function () { GetIntrinsic(nonString); },
85
+ TypeError,
86
+ debug(nonString) + ' is not a String'
87
+ );
88
+ });
89
+
90
+ forEach(v.nonBooleans, function (nonBoolean) {
91
+ t['throws'](
92
+ function () { GetIntrinsic('%', nonBoolean); },
93
+ TypeError,
94
+ debug(nonBoolean) + ' is not a Boolean'
95
+ );
96
+ });
97
+
98
+ forEach([
99
+ 'toString',
100
+ 'propertyIsEnumerable',
101
+ 'hasOwnProperty'
102
+ ], function (objectProtoMember) {
103
+ t['throws'](
104
+ function () { GetIntrinsic(objectProtoMember); },
105
+ SyntaxError,
106
+ debug(objectProtoMember) + ' is not an intrinsic'
107
+ );
108
+ });
109
+
110
+ t.end();
111
+ });
112
+
113
+ test('base intrinsics', function (t) {
114
+ t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object');
115
+ t.equal(GetIntrinsic('Object'), Object, 'Object yields Object');
116
+ t.equal(GetIntrinsic('%Array%'), Array, '%Array% yields Array');
117
+ t.equal(GetIntrinsic('Array'), Array, 'Array yields Array');
118
+
119
+ t.end();
120
+ });
121
+
122
+ test('dotted paths', function (t) {
123
+ t.equal(GetIntrinsic('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% yields Object.prototype.toString');
124
+ t.equal(GetIntrinsic('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString yields Object.prototype.toString');
125
+ t.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push');
126
+ t.equal(GetIntrinsic('Array.prototype.push'), Array.prototype.push, 'Array.prototype.push yields Array.prototype.push');
127
+
128
+ test('underscore paths are aliases for dotted paths', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) {
129
+ var original = GetIntrinsic('%ObjProto_toString%');
130
+
131
+ forEach([
132
+ '%Object.prototype.toString%',
133
+ 'Object.prototype.toString',
134
+ '%ObjectPrototype.toString%',
135
+ 'ObjectPrototype.toString',
136
+ '%ObjProto_toString%',
137
+ 'ObjProto_toString'
138
+ ], function (name) {
139
+ DefinePropertyOrThrow(Object.prototype, 'toString', {
140
+ '[[Value]]': function toString() {
141
+ return original.apply(this, arguments);
142
+ }
143
+ });
144
+ st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString');
145
+ });
146
+
147
+ DefinePropertyOrThrow(Object.prototype, 'toString', { '[[Value]]': original });
148
+ st.end();
149
+ });
150
+
151
+ test('dotted paths cache', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) {
152
+ var original = GetIntrinsic('%Object.prototype.propertyIsEnumerable%');
153
+
154
+ forEach([
155
+ '%Object.prototype.propertyIsEnumerable%',
156
+ 'Object.prototype.propertyIsEnumerable',
157
+ '%ObjectPrototype.propertyIsEnumerable%',
158
+ 'ObjectPrototype.propertyIsEnumerable'
159
+ ], function (name) {
160
+ var restore = mockProperty(Object.prototype, 'propertyIsEnumerable', {
161
+ value: function propertyIsEnumerable() {
162
+ return original.apply(this, arguments);
163
+ }
164
+ });
165
+ st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable');
166
+
167
+ restore();
168
+ });
169
+
170
+ st.end();
171
+ });
172
+
173
+ test('dotted path reports correct error', function (st) {
174
+ st['throws'](function () {
175
+ GetIntrinsic('%NonExistentIntrinsic.prototype.property%');
176
+ }, /%NonExistentIntrinsic%/, 'The base intrinsic of %NonExistentIntrinsic.prototype.property% is %NonExistentIntrinsic%');
177
+
178
+ st['throws'](function () {
179
+ GetIntrinsic('%NonExistentIntrinsicPrototype.property%');
180
+ }, /%NonExistentIntrinsicPrototype%/, 'The base intrinsic of %NonExistentIntrinsicPrototype.property% is %NonExistentIntrinsicPrototype%');
181
+
182
+ st.end();
183
+ });
184
+
185
+ t.end();
186
+ });
187
+
188
+ test('accessors', { skip: !$gOPD || typeof Map !== 'function' }, function (t) {
189
+ var actual = $gOPD(Map.prototype, 'size');
190
+ t.ok(actual, 'Map.prototype.size has a descriptor');
191
+ t.equal(typeof actual.get, 'function', 'Map.prototype.size has a getter function');
192
+ t.equal(GetIntrinsic('%Map.prototype.size%'), actual.get, '%Map.prototype.size% yields the getter for it');
193
+ t.equal(GetIntrinsic('Map.prototype.size'), actual.get, 'Map.prototype.size yields the getter for it');
194
+
195
+ t.end();
196
+ });
197
+
198
+ test('generator functions', { skip: !generatorFns.length }, function (t) {
199
+ var $GeneratorFunction = GetIntrinsic('%GeneratorFunction%');
200
+ var $GeneratorFunctionPrototype = GetIntrinsic('%Generator%');
201
+ var $GeneratorPrototype = GetIntrinsic('%GeneratorPrototype%');
202
+
203
+ forEach(generatorFns, function (genFn) {
204
+ var fnName = genFn.name;
205
+ fnName = fnName ? "'" + fnName + "'" : 'genFn';
206
+
207
+ t.ok(genFn instanceof $GeneratorFunction, fnName + ' instanceof %GeneratorFunction%');
208
+ t.ok($isProto($GeneratorFunctionPrototype, genFn), '%Generator% is prototype of ' + fnName);
209
+ t.ok($isProto($GeneratorPrototype, genFn.prototype), '%GeneratorPrototype% is prototype of ' + fnName + '.prototype');
210
+ });
211
+
212
+ t.end();
213
+ });
214
+
215
+ test('async functions', { skip: !asyncFns.length }, function (t) {
216
+ var $AsyncFunction = GetIntrinsic('%AsyncFunction%');
217
+ var $AsyncFunctionPrototype = GetIntrinsic('%AsyncFunctionPrototype%');
218
+
219
+ forEach(asyncFns, function (asyncFn) {
220
+ var fnName = asyncFn.name;
221
+ fnName = fnName ? "'" + fnName + "'" : 'asyncFn';
222
+
223
+ t.ok(asyncFn instanceof $AsyncFunction, fnName + ' instanceof %AsyncFunction%');
224
+ t.ok($isProto($AsyncFunctionPrototype, asyncFn), '%AsyncFunctionPrototype% is prototype of ' + fnName);
225
+ });
226
+
227
+ t.end();
228
+ });
229
+
230
+ test('async generator functions', { skip: asyncGenFns.length === 0 }, function (t) {
231
+ var $AsyncGeneratorFunction = GetIntrinsic('%AsyncGeneratorFunction%');
232
+ var $AsyncGeneratorFunctionPrototype = GetIntrinsic('%AsyncGenerator%');
233
+ var $AsyncGeneratorPrototype = GetIntrinsic('%AsyncGeneratorPrototype%');
234
+
235
+ forEach(asyncGenFns, function (asyncGenFn) {
236
+ var fnName = asyncGenFn.name;
237
+ fnName = fnName ? "'" + fnName + "'" : 'asyncGenFn';
238
+
239
+ t.ok(asyncGenFn instanceof $AsyncGeneratorFunction, fnName + ' instanceof %AsyncGeneratorFunction%');
240
+ t.ok($isProto($AsyncGeneratorFunctionPrototype, asyncGenFn), '%AsyncGenerator% is prototype of ' + fnName);
241
+ t.ok($isProto($AsyncGeneratorPrototype, asyncGenFn.prototype), '%AsyncGeneratorPrototype% is prototype of ' + fnName + '.prototype');
242
+ });
243
+
244
+ t.end();
245
+ });
246
+
247
+ test('%ThrowTypeError%', function (t) {
248
+ var $ThrowTypeError = GetIntrinsic('%ThrowTypeError%');
249
+
250
+ t.equal(typeof $ThrowTypeError, 'function', 'is a function');
251
+ t['throws'](
252
+ $ThrowTypeError,
253
+ TypeError,
254
+ '%ThrowTypeError% throws a TypeError'
255
+ );
256
+
257
+ t.end();
258
+ });
259
+
260
+ test('allowMissing', { skip: asyncGenFns.length > 0 }, function (t) {
261
+ t['throws'](
262
+ function () { GetIntrinsic('%AsyncGeneratorPrototype%'); },
263
+ TypeError,
264
+ 'throws when missing'
265
+ );
266
+
267
+ t.equal(
268
+ GetIntrinsic('%AsyncGeneratorPrototype%', true),
269
+ undefined,
270
+ 'does not throw when allowMissing'
271
+ );
272
+
273
+ t.end();
274
+ });
@@ -0,0 +1,16 @@
1
+ {
2
+ "root": true,
3
+
4
+ "extends": "@ljharb",
5
+
6
+ "rules": {
7
+ "func-style": [2, "declaration"],
8
+ "id-length": 0,
9
+ "multiline-comment-style": 0,
10
+ "new-cap": [2, {
11
+ "capIsNewExceptions": [
12
+ "GetIntrinsic",
13
+ ],
14
+ }],
15
+ },
16
+ }
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [ljharb]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: npm/gopd
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1 @@
1
+ export = Object.getOwnPropertyDescriptor;
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ /** @type {import('./gOPD')} */
4
+ module.exports = Object.getOwnPropertyDescriptor;
@@ -0,0 +1,5 @@
1
+ declare function gOPD<O extends object, K extends keyof O>(obj: O, prop: K): PropertyDescriptor | undefined;
2
+
3
+ declare const fn: typeof gOPD | undefined | null;
4
+
5
+ export = fn;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ /** @type {import('.')} */
4
+ var $gOPD = require('./gOPD');
5
+
6
+ if ($gOPD) {
7
+ try {
8
+ $gOPD([], 'length');
9
+ } catch (e) {
10
+ // IE 8 has a broken gOPD
11
+ $gOPD = null;
12
+ }
13
+ }
14
+
15
+ module.exports = $gOPD;
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "gopd",
3
+ "version": "1.2.0",
4
+ "description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.",
5
+ "main": "index.js",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./gOPD": "./gOPD.js",
9
+ "./package.json": "./package.json"
10
+ },
11
+ "sideEffects": false,
12
+ "scripts": {
13
+ "prepack": "npmignore --auto --commentLines=autogenerated",
14
+ "prepublishOnly": "safe-publish-latest",
15
+ "prepublish": "not-in-publish || npm run prepublishOnly",
16
+ "prelint": "tsc -p . && attw -P",
17
+ "lint": "eslint --ext=js,mjs .",
18
+ "postlint": "evalmd README.md",
19
+ "pretest": "npm run lint",
20
+ "tests-only": "tape 'test/**/*.js'",
21
+ "test": "npm run tests-only",
22
+ "posttest": "npx npm@'>=10.2' audit --production",
23
+ "version": "auto-changelog && git add CHANGELOG.md",
24
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/ljharb/gopd.git"
29
+ },
30
+ "keywords": [
31
+ "ecmascript",
32
+ "javascript",
33
+ "getownpropertydescriptor",
34
+ "property",
35
+ "descriptor"
36
+ ],
37
+ "author": "Jordan Harband <ljharb@gmail.com>",
38
+ "funding": {
39
+ "url": "https://github.com/sponsors/ljharb"
40
+ },
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/ljharb/gopd/issues"
44
+ },
45
+ "homepage": "https://github.com/ljharb/gopd#readme",
46
+ "devDependencies": {
47
+ "@arethetypeswrong/cli": "^0.17.0",
48
+ "@ljharb/eslint-config": "^21.1.1",
49
+ "@ljharb/tsconfig": "^0.2.0",
50
+ "@types/tape": "^5.6.5",
51
+ "auto-changelog": "^2.5.0",
52
+ "encoding": "^0.1.13",
53
+ "eslint": "=8.8.0",
54
+ "evalmd": "^0.0.19",
55
+ "in-publish": "^2.0.1",
56
+ "npmignore": "^0.3.1",
57
+ "safe-publish-latest": "^2.0.0",
58
+ "tape": "^5.9.0",
59
+ "typescript": "next"
60
+ },
61
+ "auto-changelog": {
62
+ "output": "CHANGELOG.md",
63
+ "template": "keepachangelog",
64
+ "unreleased": false,
65
+ "commitLimit": false,
66
+ "backfillLimit": false,
67
+ "hideCredit": true
68
+ },
69
+ "publishConfig": {
70
+ "ignore": [
71
+ ".github/workflows"
72
+ ]
73
+ },
74
+ "engines": {
75
+ "node": ">= 0.4"
76
+ }
77
+ }
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+ var gOPD = require('../');
5
+
6
+ test('gOPD', function (t) {
7
+ t.test('supported', { skip: !gOPD }, function (st) {
8
+ st.equal(typeof gOPD, 'function', 'is a function');
9
+
10
+ var obj = { x: 1 };
11
+ st.ok('x' in obj, 'property exists');
12
+
13
+ // @ts-expect-error TS can't figure out narrowing from `skip`
14
+ var desc = gOPD(obj, 'x');
15
+ st.deepEqual(
16
+ desc,
17
+ {
18
+ configurable: true,
19
+ enumerable: true,
20
+ value: 1,
21
+ writable: true
22
+ },
23
+ 'descriptor is as expected'
24
+ );
25
+
26
+ st.end();
27
+ });
28
+
29
+ t.test('not supported', { skip: !!gOPD }, function (st) {
30
+ st.notOk(gOPD, 'is falsy');
31
+
32
+ st.end();
33
+ });
34
+
35
+ t.end();
36
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "root": true,
3
+
4
+ "extends": "@ljharb",
5
+ }
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [ljharb]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: npm/has-tostringtag
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,13 @@
1
+ {
2
+ "all": true,
3
+ "check-coverage": false,
4
+ "reporter": ["text-summary", "text", "html", "json"],
5
+ "lines": 86,
6
+ "statements": 85.93,
7
+ "functions": 82.43,
8
+ "branches": 76.06,
9
+ "exclude": [
10
+ "coverage",
11
+ "test"
12
+ ]
13
+ }
@@ -0,0 +1,3 @@
1
+ declare function hasToStringTag(): boolean;
2
+
3
+ export = hasToStringTag;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var hasSymbols = require('has-symbols');
4
+
5
+ /** @type {import('.')} */
6
+ module.exports = function hasToStringTag() {
7
+ return hasSymbols() && typeof Symbol.toStringTag === 'symbol';
8
+ };
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "has-tostringtag",
3
+ "version": "1.0.2",
4
+ "author": {
5
+ "name": "Jordan Harband",
6
+ "email": "ljharb@gmail.com",
7
+ "url": "http://ljharb.codes"
8
+ },
9
+ "funding": {
10
+ "url": "https://github.com/sponsors/ljharb"
11
+ },
12
+ "contributors": [
13
+ {
14
+ "name": "Jordan Harband",
15
+ "email": "ljharb@gmail.com",
16
+ "url": "http://ljharb.codes"
17
+ }
18
+ ],
19
+ "description": "Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.",
20
+ "license": "MIT",
21
+ "main": "index.js",
22
+ "types": "./index.d.ts",
23
+ "exports": {
24
+ ".": [
25
+ {
26
+ "types": "./index.d.ts",
27
+ "default": "./index.js"
28
+ },
29
+ "./index.js"
30
+ ],
31
+ "./shams": [
32
+ {
33
+ "types": "./shams.d.ts",
34
+ "default": "./shams.js"
35
+ },
36
+ "./shams.js"
37
+ ],
38
+ "./package.json": "./package.json"
39
+ },
40
+ "scripts": {
41
+ "prepack": "npmignore --auto --commentLines=autogenerated",
42
+ "prepublishOnly": "safe-publish-latest",
43
+ "prepublish": "not-in-publish || npm run prepublishOnly",
44
+ "pretest": "npm run --silent lint",
45
+ "test": "npm run tests-only",
46
+ "posttest": "aud --production",
47
+ "tests-only": "npm run test:stock && npm run test:shams",
48
+ "test:stock": "nyc node test",
49
+ "test:staging": "nyc node --harmony --es-staging test",
50
+ "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs",
51
+ "test:shams:corejs": "nyc node test/shams/core-js.js",
52
+ "test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js",
53
+ "lint": "eslint --ext=js,mjs .",
54
+ "version": "auto-changelog && git add CHANGELOG.md",
55
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
56
+ },
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/inspect-js/has-tostringtag.git"
60
+ },
61
+ "bugs": {
62
+ "url": "https://github.com/inspect-js/has-tostringtag/issues"
63
+ },
64
+ "homepage": "https://github.com/inspect-js/has-tostringtag#readme",
65
+ "keywords": [
66
+ "javascript",
67
+ "ecmascript",
68
+ "symbol",
69
+ "symbols",
70
+ "tostringtag",
71
+ "Symbol.toStringTag"
72
+ ],
73
+ "devDependencies": {
74
+ "@ljharb/eslint-config": "^21.1.0",
75
+ "@types/has-symbols": "^1.0.2",
76
+ "@types/tape": "^5.6.4",
77
+ "aud": "^2.0.4",
78
+ "auto-changelog": "^2.4.0",
79
+ "core-js": "^2.6.12",
80
+ "eslint": "=8.8.0",
81
+ "get-own-property-symbols": "^0.9.5",
82
+ "in-publish": "^2.0.1",
83
+ "npmignore": "^0.3.1",
84
+ "nyc": "^10.3.2",
85
+ "safe-publish-latest": "^2.0.0",
86
+ "tape": "^5.7.4",
87
+ "typescript": "next"
88
+ },
89
+ "engines": {
90
+ "node": ">= 0.4"
91
+ },
92
+ "auto-changelog": {
93
+ "output": "CHANGELOG.md",
94
+ "template": "keepachangelog",
95
+ "unreleased": false,
96
+ "commitLimit": false,
97
+ "backfillLimit": false,
98
+ "hideCredit": true
99
+ },
100
+ "publishConfig": {
101
+ "ignore": [
102
+ ".github/workflows"
103
+ ]
104
+ },
105
+ "dependencies": {
106
+ "has-symbols": "^1.0.3"
107
+ }
108
+ }
@@ -0,0 +1,3 @@
1
+ declare function hasToStringTagShams(): boolean;
2
+
3
+ export = hasToStringTagShams;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var hasSymbols = require('has-symbols/shams');
4
+
5
+ /** @type {import('.')} */
6
+ module.exports = function hasToStringTagShams() {
7
+ return hasSymbols() && !!Symbol.toStringTag;
8
+ };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+ var hasSymbolToStringTag = require('../');
5
+ var runSymbolTests = require('./tests');
6
+
7
+ test('interface', function (t) {
8
+ t.equal(typeof hasSymbolToStringTag, 'function', 'is a function');
9
+ t.equal(typeof hasSymbolToStringTag(), 'boolean', 'returns a boolean');
10
+ t.end();
11
+ });
12
+
13
+ test('Symbol.toStringTag exists', { skip: !hasSymbolToStringTag() }, function (t) {
14
+ runSymbolTests(t);
15
+ t.end();
16
+ });
17
+
18
+ test('Symbol.toStringTag does not exist', { skip: hasSymbolToStringTag() }, function (t) {
19
+ t.equal(typeof Symbol === 'undefined' ? 'undefined' : typeof Symbol.toStringTag, 'undefined', 'global Symbol.toStringTag is undefined');
20
+ t.end();
21
+ });
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+
5
+ if (typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol') {
6
+ test('has native Symbol.toStringTag support', function (t) {
7
+ t.equal(typeof Symbol, 'function');
8
+ t.equal(typeof Symbol.toStringTag, 'symbol');
9
+ t.end();
10
+ });
11
+ // @ts-expect-error CJS has top-level return
12
+ return;
13
+ }
14
+
15
+ var hasSymbolToStringTag = require('../../shams');
16
+
17
+ test('polyfilled Symbols', function (t) {
18
+ /* eslint-disable global-require */
19
+ t.equal(hasSymbolToStringTag(), false, 'hasSymbolToStringTag is false before polyfilling');
20
+ // @ts-expect-error no types defined
21
+ require('core-js/fn/symbol');
22
+ // @ts-expect-error no types defined
23
+ require('core-js/fn/symbol/to-string-tag');
24
+
25
+ require('../tests')(t);
26
+
27
+ var hasToStringTagAfter = hasSymbolToStringTag();
28
+ t.equal(hasToStringTagAfter, true, 'hasSymbolToStringTag is true after polyfilling');
29
+ /* eslint-enable global-require */
30
+ t.end();
31
+ });